Bug Tracker

Modify

Ticket #5817 (closed bug: worksforme)

Opened 4 years ago

Last modified 3 years ago

jquery parents() method index bug

Reported by: inferpse Owned by: john
Priority: low Milestone: 1.4.1
Component: selector Version: 1.4
Keywords: parents index Cc:
Blocking: Blocked by:

Description

HTML:

<table class="test"> <thead> <tr>

<th>title1</th> <th>title2</th> <th>title3</th>

</tr> </thead> <tbody>

<tr><td><a href="#">link</a></td><td></td><td></td></tr> <tr><td><a href="#">link</a></td><td></td><td></td></tr> <tr><td><a href="#">link</a></td><td></td><td></td></tr>

</tbody> </table>

JAVASCRIPT:

var _table = $('table.test'); var _items = _table.find('a'); var _rows1 = _table.find('tbody tr') normal array of objects (1,2,3) var _rows2 = _items.parents('tr') reversed array of objects (3,2,1)

In jquery 1.3.2 it seems to work well.

Change History

comment:1 Changed 3 years ago by addyosmani

  • Keywords parents index added
  • Priority changed from critical to low

Test Case on jsFiddle  Live Test Case

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

"...the elements are returned in order from the closest parent to the outer ones." --  http://api.jquery.com/parents/

Dunno where we documented it in the 1.4 release notes but it was intentional.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.