Skip to main content

Bug Tracker

Side navigation

#5817 closed bug (worksforme)

Opened January 15, 2010 10:33AM UTC

Closed November 20, 2010 06:07PM UTC

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.

Attachments (0)
Change History (2)

Changed November 20, 2010 04:10AM UTC by addyosmani comment:1

keywords: → parents index
priority: criticallow

Test Case on jsFiddle Live Test Case

Changed November 20, 2010 06:07PM UTC by dmethvin comment:2

resolution: → worksforme
status: newclosed
"...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.