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.
*** This bug has been marked as a duplicate of 17461 ***
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.