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
http://lachy.id.au/
http://www.opera.com/

Reply via email to