W3C home > Mailing lists > Public > public-webapi@w3.org > March 2008

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

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Wed, 12 Mar 2008 22:44:47 +0100
Message-ID: <47D84ECF.4050402@lachy.id.au>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: liorean <liorean@gmail.com>, "Web APIs WG (public)" <public-webapi@w3.org>

Boris Zbarsky wrote:
> 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); 

Yes, that is the correct behaviour.  It should indeed match any element 
in the element's subtree, regardless of whether or not that element is 
in a document.  I thought the spec was clear enough on that issue already.

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

There is no reason for them to be explicitly excluded, especially if 
it's easier for them to be included.

Lachlan Hunt - Opera Software
Received on Wednesday, 12 March 2008 21:45:04 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:25 UTC