W3C home > Mailing lists > Public > www-style@w3.org > June 2015

Re: [selectors][css-syntax] Allow comma-separated lists of An+B?

From: Daniel Tan <lists@novalistic.com>
Date: Tue, 23 Jun 2015 02:29:53 +0800
Message-ID: <55885421.20602@novalistic.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: "<www-style@w3.org>" <www-style@w3.org>
On 6/23/2015 2:13 AM, Tab Atkins Jr. wrote:
> On Mon, Jun 22, 2015 at 10:07 AM, Daniel Tan <lists@novalistic.com> wrote:
>> On the surface, it seems fairly trivial to extend pseudo-classes that take
>> An+B expressions such that they allow multiple expressions in a single
>> pseudo-class. This could be very handy for targeting many specific children
>> in a way that cannot be easily written in a single, or few, expressions:
>>
>>      td:nth-of-type(1, 3, 7, 10)
>>
>> Admittedly, this feature would be used almost exclusively with integers
>> rather than entire An+B expressions, but actively restricting the
>> microsyntax in lists seems pointless.
>>
>> There is :matches(), but it requires having to repeat the pseudo-class which
>> is not ideal:
>>
>>      td:matches(
>>        :nth-of-type(1), :nth-of-type(3),
>>        :nth-of-type(7), :nth-of-type(10)
>>      )
>>
>> This isn't nearly as popular as :matches(), :has(), or :nth-child(An+B of
>> sel), but it does come up fairly often. That said I'm curious to know what
>> it would take to implement (and justify implementing) such a feature.
>
> There's nothing wrong with that at a parsing level.  The more complex
> grammar of :nth-child() is a bit more difficult, though -
> comma-separated indexes, or whole entries?
>
> ~TJ
>

Good point - what I initially had in mind was :nth-child(An+B, Cn+D of 
sel1, sel2), but I can see how that could be interpreted as 
:nth-child(An+B of sel1, Cn+D of sel2) instead, or how someone might 
want to write it that way. I hadn't quite thought that through.

It seems the complexity of this would be too great taking the 
selector-list argument into account :/

-- 
Daniel Tan
NOVALISTIC
<http://NOVALISTIC.com>
Received on Monday, 22 June 2015 18:30:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:55 UTC