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

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

From: Daniel Tan <lists@novalistic.com>
Date: Tue, 23 Jun 2015 01:07:20 +0800
Message-ID: <558840C8.2010709@novalistic.com>
To: "<www-style@w3.org>" <www-style@w3.org>
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:

       :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.

Daniel Tan
Received on Monday, 22 June 2015 17:07:50 UTC

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