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

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

From: Alex Russell <slightlyoff@google.com>
Date: Wed, 19 Oct 2011 01:13:49 +0100
Message-ID: <CANr5HFURZ1dPinA-5sP4oHdgk4au+OdC_QENe6kz4+atSvgt8A@mail.gmail.com>
To: Brian Kardell <bkardell@gmail.com>
Cc: Erik Arvidsson <arv@chromium.org>, John Resig <jeresig@gmail.com>, Lachlan Hunt <lachlan.hunt@lachy.id.au>, Paul Irish <paulirish@google.com>, Webapps WG <public-webapps@w3.org>, Yehuda Katz <wycats@gmail.com>
On Wed, Oct 19, 2011 at 12:45 AM, Brian Kardell <bkardell@gmail.com> wrote:
> Some pseudos can contain selector groups, so it would be more than just
> split on comma.

Yes, yes, of course. I've written one of these parsers. Just saying
that the impl would split selector groups and prefix them all with
":scope "

> On Oct 18, 2011 7:40 PM, "Alex Russell" <slightlyoff@google.com> wrote:
>>
>> On Tue, Oct 18, 2011 at 6:00 PM, Erik Arvidsson <arv@chromium.org> wrote:
>> > 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?
>>
>> Heh. Yes ;-)
>>
>> > 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.
>>
>> I agree. I left should have mentioned it. The resolution I think is
>> most natural is to split on "," and assume that all selectors in the
>> list are ":scope" prefixed and that. A minor point is how to order the
>> items in the returned flattened list are ordered (document order? the
>> natural result of concat()?).
>>
>
Received on Wednesday, 19 October 2011 00:14:45 GMT

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