>From reading the spec, it wasn't immediately clear to me which of the
following two cases applies to element.querySelectorAll (and similarly
to element.querySelector):



1.      The nodes returned are the nodes that match
document.querySelectorAll AND are contained within the subtree rooted at
the element.
2.      The nodes returned are the nodes that match the group of
selectors if the selection algorithm is run only on the subtree rooted
at the element.



Put as an example (which is probably clearer), with the following
document:



<html>

 <body>

  <div id="foo">

   <a
href="javascript:alert(document.getElementById('foo').querySelector('bod
y a'));">test</a>

  </div>

 </body>

</html>



If case (1) applies, then the querySelector should match the anchor tag
and the dialog should show [object HTMLAnchorElement]. If case (2)
applies, then since there is no "body" tag within the <div id="foo">,
nothing will match and the alert dialog will show null. None of the
browser versions I currently have installed support querySelector yet,
so I couldn't check against their implementations.



Any clarification would be appreciated.



Thanks,

Kartikaya Gupta


---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful.

Reply via email to