W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2019

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

From: Sebastian Zartner via GitHub <sysbot+gh@w3.org>
Date: Mon, 22 Jul 2019 08:12:59 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-470954623-1563783177-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:27:01 UTC