W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

Re: [SelectorsAPI] Thoughts on querySelectorAll

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 30 Apr 2008 15:28:54 -0700
Message-ID: <4818F2A6.6060006@sicking.cc>
To: John Resig <jresig@mozilla.com>
CC: "L. David Baron" <dbaron@dbaron.org>, public-webapi@w3.org

John Resig wrote:
> 
>> I presume what you want instead is that element-rooted queries are
>> handled by matching such that each simple selector (CSS2 definition)
>> or sequence of simple selectors (css3-selectors definition, and I
>> *still* object to changing the meaning of existing terms) must match
>> an element that is or is a descendant of the specified element (the
>> root of the query).
>>
>> Or do you want to eliminate "is or" in my previous paragraph, to
>> exclude the query root?  Or something else?
> 
> I would exclude "is or" - only descendant elements, in this case. For example:
> 
>   <div><div id="test"><div><div id="inner"></div></div></div></div>
>   <script>
>   // matches <div id="inner"></div>
>   document.getElementById("test").querySelectorAll("div div").length == 1
>   </script>

But that would mean that .querySelectorAll(":root div") would never 
match anything since :root (or :scope) could only match the element 
itself, which of course isn't a descendant.

/ Jonas
Received on Wednesday, 30 April 2008 22:30:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 April 2008 22:30:21 GMT