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:08:42 -0700
Message-ID: <4818EDEA.5040506@sicking.cc>
To: John Resig <jresig@mozilla.com>
CC: public-webapi@w3.org

John Resig wrote:
> Hello Everyone -
> 
> I just wanted to quickly pull together some of my thoughts concerning querySelectorAll. I've been asked by a number of people to provide my feedback here. Please forgive me if I've missed some previous discussions on the subject matter.
> 
> There's three major points that I wanted to discuss:
> 
> * DOMElement.querySelectorAll returning incorrect elements

So am I understanding you right in that if we do provide the second 
issue (Combinator-rooted Queries) then that will resolve your concern 
about this issue?

I do understand your concern that in most cases you probably don't want 
the selector matching to "leak" out of the node on which 
.querySelectorAll was called. But I think spec-wise it's easier if the 
problem can be solved by using the ":root trick" or some such. That way 
the Webapi WG doesn't have to define a pile of new behavior for general 
selector matching.

The added bonus of the current matching is that it does allow for the 
selector to "leak" should you want that for whatever reason.

The libraries out there would only need to prepend ":root " to whatever 
selector they were handed.

Though rather than using ":root" I think it would be more appropriate to 
use ":scope" as has been proposed in other mails on this list. It's 
entirely possible that mozilla could include an implementation of that 
along with the initial querySelectorAll implementation (though perhaps 
under the name :-moz-scope)

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

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