Re: [SelectorsAPI] Thoughts on querySelectorAll

> 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?

Not really, no - that would presume that it's obvious to prepend :root to every single one of your element-rooted queries in order to make them work.

  element.querySelectorAll(":root div span")

This goes beyond 'JavaScript libraries' in this case - it simply isn't intuitive to require extra syntax to get the right result.

> 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.

This isn't really important since this result can already be achieved in another manner, using .compareDocumentPosition() or .contains() (in IE). However, leaving it "broken by default because it would be hard to specify" doesn't really seem to mesh well.

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

Sure - this is fine for invalid selectors (such as combinator-rooted ones) - which is why I like that particular suggestion. However, requiring them for all plain-old element queries doesn't seem to work well.

--John

Received on Wednesday, 30 April 2008 22:22:01 UTC