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

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

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