Side navigation
#12241 closed bug (fixed)
Opened August 10, 2012 10:57AM UTC
Closed August 29, 2012 12:35AM UTC
Last modified October 15, 2012 08:21PM UTC
Passing a negative index for :eq throws a syntax error.
Reported by: | r.osenkonstantinov@gmail.com | Owned by: | timmywil |
---|---|---|---|
Priority: | low | Milestone: | 1.8.1 |
Component: | selector | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If negative index is set for :eq a syntax error is thrown. Here is a basic selector: $("div").children(":eq(-1)") and a jsbin sample http://jsbin.com/ovurif/1/edit.
The documentation states that it is not supported but an empty set will be returned. Which unfortunately is not true with the 1.8:
"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."
Attachments (0)
Change History (6)
Changed August 10, 2012 03:58PM UTC by comment:1
component: | unfiled → selector |
---|---|
milestone: | None → 1.8.1 |
owner: | → timmywil |
priority: | undecided → low |
status: | new → assigned |
Changed August 10, 2012 04:00PM UTC by comment:2
Well, working as documented, which is to say they return nothing.
Changed August 10, 2012 04:02PM UTC by comment:3
Actually, I was thinking it would be easy to make it work the same way as the method.
Changed August 29, 2012 12:35AM UTC by comment:4
resolution: | → fixed |
---|---|
status: | assigned → closed |
Sizzle: support negative numbers in :eq
. Fixes #12241.
Changeset: fbdf8bed4fa34b6c922a287060ffaa01a55245a9
Changed September 07, 2012 04:34PM UTC by comment:5
keywords: | → needsdocs |
---|
As of 1.8.1 the :eq()
selector now supports negative numbers the same way the .eq()
method does.
Changed October 15, 2012 08:21PM UTC by comment:6
keywords: | needsdocs |
---|
I don't have a problem with negative values working. We can fix that in the next patch release.