RE: [selectors-api] Why no querySelector(All) on DocumentFragments?

Also, for nodes that *are* connected to the document, does the search
still start from the root of the document, or from the element on which
the query is invoked? (i.e. In the following case, does the anchor
element match?):

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

-----Original Message-----
From: public-webapi-request@w3.org [mailto:public-webapi-request@w3.org]
On Behalf Of Boris Zbarsky
Sent: Wednesday, March 12, 2008 5:01 PM
To: liorean
Cc: Web APIs WG (public)
Subject: Re: [selectors-api] Why no querySelector(All) on
DocumentFragments?


liorean wrote:
> As a disconnected node would not be in the node tree from document,
> can it match a query at all?

That's a really good question!   It seems to match in the webkit nightly

I just tried here, as well as in IE8.  Simple testcase:

javascript:var n = 
document.createElement("div");n.appendChild(document.createElement("span
"));alert(n.querySelector("span").tagName);

Paste this into your URL bar of choice.

A naive implementation in Gecko would also match such nodes unless they 
are purposefully excluded.

If the intent is that these nodes not match, the spec obviously needs to

spell it out a lot more clearly than it currently does.

-Boris



---------------------------------------------------------------------
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.

Received on Wednesday, 12 March 2008 21:18:05 UTC