Bug Tracker

Ticket #5817 (closed bug: worksforme)

Opened 6 years ago

Last modified 5 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:



<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>


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 5 years ago by addyosmani

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

Test Case on jsFiddle  Live Test Case

comment:2 Changed 5 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.

Note: See TracTickets for help on using tickets.