RESOLVED DUPLICATE of bug 17461 17731
Node.querySelectorAll() scopes selection incorrectly
https://bugs.webkit.org/show_bug.cgi?id=17731
Summary Node.querySelectorAll() scopes selection incorrectly
Borgar Þorsteinsson
Reported 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.
Attachments
Sam Weinig
Comment 1 2008-03-09 08:14:31 PDT
*** This bug has been marked as a duplicate of 17461 ***
Borgar Þorsteinsson
Comment 2 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.
Note You need to log in before you can comment on or make changes to this bug.