Side navigation
#11109 closed bug (fixed)
Opened December 27, 2011 05:46PM UTC
Closed June 15, 2012 06:12AM UTC
Last modified June 19, 2012 06:32AM UTC
Sizzle: Expr.relative truncates prematurely
Reported by: | gibson042 | Owned by: | timmywil |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | selector | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Work on #10868 revealed this error in oldSizzle: http://jsfiddle.net/JBBM8/
Because Sizzle.selectors.relative
functions "return" only a single match, Sizzle can be trapped into a false negative with respect to preceding parts
of the full selector when the relative selector tests against multiple elements (e.g., "~"
and ""
).
I'm pretty sure that fixing this will require changing the Sizzle.selectors.relative
Extension API to allow "returning" ''arrays'', so I will hold off working on this until the core team weighs in with their comments/approval.
Attachments (0)
Change History (10)
Changed December 27, 2011 05:59PM UTC by comment:1
Changed January 11, 2012 04:49PM UTC by comment:2
resolution: | → duplicate |
---|---|
status: | new → closed |
Can you coordinate with timmywil on this? He's got #10697. I'll mark this one as a dup but really it seems like this should be filed as a Sizzle bug.
Changed June 11, 2012 05:59PM UTC by comment:4
component: | unfiled → selector |
---|---|
milestone: | None → 1.next |
priority: | undecided → high |
resolution: | duplicate |
status: | closed → reopened |
Reopening as this was not addressed in the rewrite. Here is another test case that i think is related:
http://jsfiddle.net/timmywil/a6E3V/3/
Also see:
http://javascript.nwbox.com/NWMatcher/release/test/css3-compat/sibling-test.html
Changed June 11, 2012 05:59PM UTC by comment:5
owner: | → timmywil |
---|---|
status: | reopened → assigned |
Changed June 15, 2012 01:26AM UTC by comment:6
OK, it seems the sibling issues from nwbox are already fixed, so those aren't related. However, there is still an issue with deeper levels. The fiddles are still valid.
Changed June 15, 2012 01:34AM UTC by comment:7
milestone: | 1.next → 1.8 |
---|
A combination combinator fiddle for the masses: http://jsfiddle.net/timmywil/WSrGh/. Working on it.
Changed June 15, 2012 06:12AM UTC by comment:8
resolution: | → fixed |
---|---|
status: | assigned → closed |
Changed June 15, 2012 06:24PM UTC by comment:9
Update Sizzle. Fixes #11109.
Changeset: 8763bec032bc2dc10bf0d6686b820b731b525091
Changed June 19, 2012 06:32AM UTC by comment:10
#11079 is a duplicate of this ticket.
Technical explanation:
Given a query like
"A + B ~ C"
, Sizzle:1. Gets a set of all
C
, then2. Uses
Sizzle.selectors.relative["~"]
to replace each element with the first preceding sibling element matchingB
(orfalse
if nonexistent), then3. Uses
Sizzle.selectors.relative["+"]
to replace each element with the preceding sibling element if it matchesA
(orfalse
if it doesn't), then4. Returns all elements from the set at step 1 that stayed non-
false
through all subsequent stepsThe problem here is that step 2 fails to report back ''all'' preceding siblings matching
B
, erroneously restricting the input set for subsequent step 3.