Bug Tracker

Opened 6 years ago

Closed 6 years ago

#5817 closed bug (worksforme)

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:
Blocked by: Blocking:

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 (2)

comment:1 Changed 6 years ago by addyosmani

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

Test Case on jsFiddle Live Test Case

comment:2 Changed 6 years ago by dmethvin

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

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