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: Sat, 15 Mar 2008 02:07:16 +0100
Message-ID: <47DB2144.5040708@lachy.id.au>
To: Anne van Kesteren <annevk@opera.com>
Cc: Maciej Stachowiak <mjs@apple.com>, Jonas Sicking <jonas@sicking.cc>, Boris Zbarsky <bzbarsky@mit.edu>, "Web APIs WG (public)" <public-webapi@w3.org>

Anne van Kesteren wrote:
> If :scope needs to work matching in implementations might need to change 
> by the way. Currently matching is only against the subtree. So 
> <div>.querySelector("div") would only match descendant <div> elements.

That just means that it will only return elements that are descendants, 
but selects are still evaluated in the context of the entire tree.

   div.querySelector(":scope");

won't return anything, since the the selecor is referring to the element 
itself and is therefore quite a useless thing to do, but:

   div.querySelector(":scope>span")

will return only span elements that are children of that div element.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Saturday, 15 March 2008 01:07:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 15 March 2008 01:07:56 GMT