Skip to main content

Bug Tracker

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: Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

The selector $('foo:eq(-1)') returns the last foo, but the documentation claims this should result in an empty set.

Fiddle demonstrating behavior:


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 dmethvin comment:1

status: newopen

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.

Changed October 11, 2012 03:39AM UTC by ajpiano comment:2

keywords: → needsdocs
resolution: → notabug
status: openclosed

Ported this over to and closing this.

Changed October 15, 2012 08:04PM UTC by mikesherov comment:3

keywords: needsdocs