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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 22 Jun 2015 11:13:56 -0700
Message-ID: <CAAWBYDC9qF3AEzcf4aHa3sWcey5Xiy0jGYJ3sfPDWzYEYXTZ4A@mail.gmail.com>
To: lists@novalistic.com
Cc: "<www-style@w3.org>" <www-style@w3.org>
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?

Received on Monday, 22 June 2015 18:14:43 UTC

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