liorean wrote: > Isn't this approach potentially much more resource intensive though? Not for the typical browser workload, which is to match a node to a whole bunch of rules.... So I guess it depends on whether querySelector reuses the existing selector matching code. > The Selectors spec doesn't really deal with the DOM though. But it does. It's all in terms of a tree and stuff.. The question is whether the "tree" for a node is the tree rooted by its ownerDocument or the connected tree containing the node. I should note that interoperability for detached subtrees is pretty poor. For example, consider the following: javascript:var n = document.createElement("div");n.appendChild(document.createElement("span"));alert(n.querySelector(":root span")); Webkit nightly returns null. IE throws (no :root support). Gecko prototype implementation returns the span, since :root will match any node with no ancestors. So I do think that the spec needs a lot more detail here... -BorisReceived on Thursday, 13 March 2008 03:49:00 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 March 2008 03:49:01 GMT