Bug 17731 - Node.querySelectorAll() scopes selection incorrectly
Summary: Node.querySelectorAll() scopes selection incorrectly
Status: RESOLVED DUPLICATE of bug 17461
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-09 07:56 PDT by Borgar Þorsteinsson
Modified: 2008-03-09 08:24 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Borgar Þorsteinsson 2008-03-09 07:56:53 PDT
Calling document.getElementById('scope').querySelectorAll('body p') returns all paragraphs within context (#scope). I would have expected it to return an empty set.

querySelectorAll seems to be currently selecting all paragraphs within context node, and then checking which are within the scope. Or it finds all paragraphs within context and tries to match them to the selector. However the method, this causes false positives as there are no body tags within the scope.

I would have expected document.getElementById('scope').querySelectorAll('body p') to work exactly like document.querySelectorAll('#scope body p'). This is how all the js engines work, and how IE8 has implemented it.

I'm seeing failures on a lot of other selectors but it's completely consistent with this example.
Comment 1 Sam Weinig 2008-03-09 08:14:31 PDT

*** This bug has been marked as a duplicate of 17461 ***
Comment 2 Borgar Þorsteinsson 2008-03-09 08:24:27 PDT
I would like to correct my statement that IE8 behaves as I expected, it does not. This was me messing up my test. IE8 and WebKit behave in the same way.