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 09:24:53 +0100
Message-ID: <CANr5HFUN0V5TcRef08EOqyzxW-V=xuinq6NmNhHCcfp5HO=F9A@mail.gmail.com>
To: Ojan Vafai <ojan@chromium.org>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, public-webapps@w3.org
On Wed, Oct 19, 2011 at 4:39 AM, Ojan Vafai <ojan@chromium.org> wrote:
> Overall, I wholeheartedly support the proposal.
> I don't really see the benefit of allowing starting with a combinator. I
> think it's a rare case that you actually care about the scope element and in
> those cases, using :scope is fine. Instead of element.findAll("> div >
> .thinger"), you use element.findAll(":scope > div > .thinger"). That said, I
> don't object to considering the :scope implied if the selector starts with a
> combinator.

Right, I think the argument for allowing a combinator start is two-fold:

1.) the libraries allow it, so should DOM
2.) we know the thing on the left, it's the implicit scope. Shorter is
better, so allowing the implicitness here is a win on that basis

I have a mild preference for argument #2. Shorter, without loss of
clarity, for common stuff should nearly always win.

> On Tue, Oct 18, 2011 at 6:15 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>>
>> On 10/18/11 7:38 PM, Alex Russell wrote:
>>>
>>> The resolution I think is most natural is to split on ","
>>
>> That fails with :any, with the expanded :not syntax, on attr selectors,
>> etc.
>>
>> You can split on ',' while observing proper paren and quote nesting, but
>> that can get pretty complicated.
>
> Can we define it as a sequence of selectors and be done with it? That way it
> can be defined as using the same parsing as CSS.
>
>>>
>>> A minor point is how to order the
>>> items in the returned flattened list are ordered (document order? the
>>> natural result of concat()?).
>>
>> Document order.
>
> Definitely.
>>
>> -Boris
>>
>>
>
>
Received on Wednesday, 19 October 2011 08:25:56 GMT

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