W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2008

Re: [selectors-api] Matching subtrees or not

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 19 Nov 2008 13:02:29 -0500
Message-ID: <492454B5.3070000@mit.edu>
To: Gavin Kistner <gavin@phrogz.net>
CC: public-webapps@w3.org

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:28 GMT