Closed
Bug 667520
Opened 14 years ago
Closed 14 years ago
querySelectorAll nth-child returns inaccurate results
Categories
(Core :: DOM: Core & HTML, defect, P1)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
mozilla7
People
(Reporter: bkardell, Assigned: bzbarsky)
References
Details
Attachments
(2 files, 1 obsolete file)
|
1.23 KB,
text/html
|
Details | |
|
3.71 KB,
patch
|
dbaron
:
review+
dbaron
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110615151330
Steps to reproduce:
Was experiencing a problem in jquery, but it seems due to delegation to querySelector all. Created a test page and verified that CSS and querySelector all give me the same results for an nth-child(4n) style selector in other browsers, but not in FF 5.
Actual results:
CSS appears to match other browsers (and spec) but querySelectorAll results in different matches in FF5.
Expected results:
CSS and querySelectorAll should have the same result for the same selector.
Updated•14 years ago
|
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
| Assignee | ||
Updated•14 years ago
|
Attachment #542207 -
Attachment filename: live.html → test.html
| Assignee | ||
Updated•14 years ago
|
Attachment #542207 -
Attachment filename: test.html → live.html
Attachment #542207 -
Attachment mime type: text/plain → text/html
| Assignee | ||
Comment 1•14 years ago
|
||
Argh. This is a bug in the nth-index cache. What happens is that we only have cached values for the <div>s and we end up adding 1 to the previous cached value we find. That's broken, of course.
In Gecko 2.0, we only looked at the immediate previous sibling, so adding just 1 was correct.
We should get this fixed on aurora (Fx6) in addition to m-c, I think.
Assignee: nobody → bzbarsky
Blocks: 598832
Status: UNCONFIRMED → NEW
tracking-firefox6:
--- → ?
tracking-firefox7:
--- → ?
Ever confirmed: true
| Assignee | ||
Updated•14 years ago
|
Priority: -- → P1
Version: 5 Branch → Trunk
| Assignee | ||
Comment 2•14 years ago
|
||
Attachment #542219 -
Flags: review?(dbaron)
| Assignee | ||
Comment 3•14 years ago
|
||
Attachment #542224 -
Flags: review?(dbaron)
| Assignee | ||
Comment 4•14 years ago
|
||
Comment on attachment 542224 [details] [diff] [review]
Merged to
Wrong bug.
Attachment #542224 -
Flags: review?(dbaron)
| Assignee | ||
Updated•14 years ago
|
Whiteboard: [need review]
| Assignee | ||
Updated•14 years ago
|
Attachment #542224 -
Attachment is obsolete: true
Comment on attachment 542219 [details] [diff] [review]
Fix nth index cache to work correctly when nth-child selectors are only applied to some elements of a child list.
r=dbaron
Attachment #542219 -
Flags: review?(dbaron) → review+
Updated•14 years ago
|
OS: Other → All
| Assignee | ||
Comment 6•14 years ago
|
||
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla7
| Assignee | ||
Comment 7•14 years ago
|
||
Comment on attachment 542219 [details] [diff] [review]
Fix nth index cache to work correctly when nth-child selectors are only applied to some elements of a child list.
Requesting approval to land this on aurora. This fixes a regression in querySelector handling of the various nth-child and nth-of-type selectors (as well as handling of actual selector matching in some cases) that we unfortunately shipped in Firefox 5. The fix is very very safe, and the old code is clearly wrong....
Attachment #542219 -
Flags: approval-mozilla-aurora?
Comment on attachment 542219 [details] [diff] [review]
Fix nth index cache to work correctly when nth-child selectors are only applied to some elements of a child list.
approved for aurora (in triage meeting)
Attachment #542219 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
| Assignee | ||
Comment 9•14 years ago
|
||
http://hg.mozilla.org/releases/mozilla-aurora/rev/d8b00ee31575
Brian, thank you for reporting this! The fix will ship in Firefox 6 in about 7 weeks.
status-firefox5:
--- → affected
status-firefox6:
--- → fixed
Comment 10•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 11•14 years ago
|
||
Thanks guys.
tracking-firefox7:
? → ---
Comment 12•14 years ago
|
||
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20100101 Firefox/6.0
Mozilla/5.0 (X11; Linux x86_64; rv:7.0a2) Gecko/20110811 Firefox/7.0a2
Mozilla/5.0 (X11; Linux x86_64; rv:8.0a1) Gecko/20110807 Firefox/8.0a1
Verified on Ubuntu 11.04, MAC OS X 10.6, Windows 7, Windows XP with the attachment test case from the description. The results are now the same as other browsers (Opera, Chrome). The initial incorrect results on Firefox are no longer reproducible.
Setting status to verified Fixed.
Status: RESOLVED → VERIFIED
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•