Re: [selectors-api] Matching subtrees or not

Gavin Kistner wrote:
> Section 6 states:
> "The querySelector() method ... must ... return the first matching 
> Element node ***within the node’s subtree***." [1]

That's correct.  The Element must be matching, and must be inside the 
subtree rooted by the context node.

> "Even though the method is invoked on an element, ***selectors are still 
> evaluated in the context of the entire document***.

This is also correct.  Determining whether an Element is matching does 
not use the context node in any way (modulo a possible :context selector 
in the future).

I don't see a contradiction here.

Note that there have been proposals that the matching algorithm take the 
context node into account discussed in the past on this mailing list (or 
maybe on public-webapi).  I urge you to read those threads.

-Boris

Received on Wednesday, 19 November 2008 18:03:12 UTC