[csswg-drafts] Alternative syntax for <An+B> in selectors (#4140)

SebastianZ has just created a new issue for https://github.com/w3c/csswg-drafts:

== Alternative syntax for <An+B> in selectors ==
To express the selection of the first or last n elements the An+B syntax is somewhat hard to understand. It requires the author to calculate the different resulting index values and requires them to know that negative indexes are ignored.

Therefore, I suggest to introduce a simpler syntax that covers those cases. My suggestions:

`to n` or `n <= x`

Positive side effect is that these syntaxes would allow to extend them to specify ranges, i.e. `m to n` or `x <= n <= y`. With that there wouldn't be the need anymore to define the ranges using both the `:nth-child()` and `:nth-last-child()` pseudo-classes resp. `:nth-of-type()` and `:nth-last-of-type()`.
The latter also aligns with the new range syntax introduced for media queries.

Sebastian

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4140 using your GitHub account

Received on Monday, 22 July 2019 08:13:01 UTC