Incorrect documentation for the index method?
|Reported by:||AbeMiessler@…||Owned by:||rwaldron|
You have the following documentation for index with no parameters:
If no argument is passed to the .index() method, the return value is an integer indicating the position of the first element within the jQuery object relative to its sibling elements.
But if you run this jQuery:
Against this HTML:
<ul> <li class="selected">First Item</li> <li class="disabled">Second Item</li> <li class="separator">Third Item</li> <li>Fourth Item</li> </ul>
It returns 3 instead of 0. You can see that the selector will find two elements (the first and last LI), but it returns the index of the last element, when your documentation says it will return the index of the first.
Can be seen in this fiddle: http://jsfiddle.net/Zf9Vv/
Change History (8)
comment:3 Changed 5 years ago by rwaldron
- Component changed from unfiled to traversing
- Owner set to rwaldron
- Priority changed from undecided to high
- Status changed from new to assigned
comment:5 Changed 4 years ago by mikesherov
- Keywords needsdocs removed
- Resolution set to notabug
- Status changed from assigned to closed
comment:6 Changed 4 years ago by mikesherov
- Resolution notabug deleted
- Status changed from closed to reopened