Summary: | querySelectorAll doesn't return correct nodes when using element in element patterns | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Moxiecode Systems <spam> | ||||
Component: | DOM | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED INVALID | ||||||
Severity: | Normal | CC: | annevk, aroben, borgar | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | PC | ||||||
OS: | All | ||||||
Attachments: |
|
Description
Moxiecode Systems
2008-02-20 15:38:27 PST
Created attachment 19242 [details]
Testcase to illustrate the bug.
This test case will alert 4 but should alert 1 since only one div is inside another div.
I'd mark this INVALID, but can't. Anyway, selectors are always matched agains the document element. However, for calls on element nodes all nodes not part of the sub tree of that element node are filtered out. This is why you end up with 4 and not 1 or 5. I shouild have mentioned that we will clarify the specification in due course to make this more explicit. Marking INVALID per Anne's comments. Hmm, strange since this is not the way common libraries like jQuery/Prototype etc work. They all return 1 if you scope the search to an specific element so this can't be used as an replacement for those APIs. I could not find anything about this in the W3C specification so I'm wondering what is the correct behavior? |