W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

Re: [selectors-api] Scoped Queries

From: Sean Hogan <shogun70@westnet.com.au>
Date: Thu, 24 Sep 2009 14:37:06 +1000
Message-ID: <4ABAF772.9060507@westnet.com.au>
To: John Resig <jresig@mozilla.com>
CC: Jonas Sicking <jonas@sicking.cc>, Lachlan Hunt <lachlan.hunt@lachy.id.au>, public-webapps <public-webapps@w3.org>, "L. David Baron" <dbaron@mozilla.com>
John Resig wrote:
>     Libraries already parse selector queries anyway. And some of them
>     add non-standard selectors and presumeably will continue to do so.
>     I don't think it is an issue.
> However the parsing only happens after the selector has been passed to 
> the native querySelectorAll implementation. We assume the qSA will 
> provide the fastest solution. If it throws an exception we then branch 
> off into the old, slower, selector engine and forget qSA entirely. 
> Since there's no good error-reporting coming from qSA we can't, 
> reasonably, determine how or why an error happened (was it a syntax 
> error (foo<bar)? is the selector supposed to be supported but just 
> isn't (div:nth-of-type(2) in IE 8)? does it look like a valid selector 
> but there's no existing implementation (div:first)?).
> If there were two solutions, one that forced you to use :scope in 
> front of all queries (or sub-queries) and one that had a separate 
> method that handled cases like "> div" properly, I'd take the latter. 
> Parsing queries sucks and is slow, it's easier to just pass all of 
> that off to the browser.
> --John
Yes, it will have to be a new method.
"> div" may be unambiguously ":scope > div", but if you allow it then 
people will expect "div p" to be ":scope div p"which would conflict the 
current definition.
Received on Thursday, 24 September 2009 04:37:59 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:18 UTC