Side navigation
#12682 closed bug (notabug)
Opened October 09, 2012 09:11AM UTC
Closed October 11, 2012 03:39AM UTC
Last modified October 15, 2012 08:04PM UTC
:eq() behavior does not match documentation
| Reported by: | niek.sanders@gmail.com | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.8.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
The selector $('foo:eq(-1)') returns the last foo, but the documentation claims this should result in an empty set.
Fiddle demonstrating behavior: http://jsfiddle.net/Gj5Qj/3/
Documentation: http://api.jquery.com/eq-selector/
Specific documentation text: "Unlike the .eq(index) method, the :eq(index) selector does not accept a negative value for index. For example, while $('li').eq(-1) selects the last li element, $('li:eq(-1)') selects nothing."
Able to reproduce in both Chrome (v19) and Firefox (v11) on Linux.
Attachments (0)
Change History (3)
Changed October 09, 2012 01:05PM UTC by comment:1
| status: | new → open |
|---|
Changed October 11, 2012 03:39AM UTC by comment:2
| keywords: | → needsdocs |
|---|---|
| resolution: | → notabug |
| status: | open → closed |
Ported this over to https://github.com/jquery/api.jquery.com/issues/83 and closing this.
Changed October 15, 2012 08:04PM UTC by comment:3
| keywords: | needsdocs |
|---|
That was an intended change in 1.8, we wanted the method and the selector to have equivalent behavior. So yes the docs need to be updated.