W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: QSA, the problem with ":scope", and naming

From: Erik Arvidsson <arv@chromium.org>
Date: Tue, 18 Oct 2011 10:00:10 -0700
Message-ID: <CAJ8+Gog8AMpq7JC+AAALNvYnwy8QuboFPoj2J=LTRpChW+WvfA@mail.gmail.com>
To: Alex Russell <slightlyoff@google.com>
Cc: Webapps WG <public-webapps@w3.org>, Yehuda Katz <wycats@gmail.com>, John Resig <jeresig@gmail.com>, Paul Irish <paulirish@google.com>, Lachlan Hunt <lachlan.hunt@lachy.id.au>
On Tue, Oct 18, 2011 at 09:42, Alex Russell <slightlyoff@google.com> wrote:
> Ah, but we don't need to care what CSS thinks of our DOM-only API. We
> can live and let live by building on ":scope" and specifying find* as
> syntactic sugar, defined as:
>
>  HTMLDocument.prototype.find =
>  HTMLElement.prototype.find = function(rootedSelector) {
>     return this.querySelector(":scope " + rootedSelector);
>   }
>
>   HTMLDocument.prototype.findAll =
>   HTMLElement.prototype.findAll = function(rootedSelector) {
>     return this.querySelectorAll(":scope " + rootedSelector);
>   }

I like the way you think. Can I subscribe to your mailing list?

One thing to point out with the desugar is that it has a bug and most
JS libs have the same but. querySelectorAll allows multiple selectors,
separated by a comma and to do this correctly you need to parse the
selector which of course requires tons of code so no one does this.
Lets fix that by building this into the platform.

-- 
erik
Received on Tuesday, 18 October 2011 17:01:02 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:48 GMT