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

Re: [csswg-drafts] Make it easier to express ranges for <An+B> selectors (#4140)

From: Sebastian Zartner via GitHub <sysbot+gh@w3.org>
Date: Wed, 31 Jul 2019 21:54:59 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-517036947-1564610098-sysbot+gh@w3.org>
My main use case was to make it easier to express the first or last n elements, but if we want to allow values other than `1n` and offsets with this new range syntax, that's easily doable as @Loirooriol already pointed out. It would then be

`C <= An+B <= D`

> But `:nth-child(An+B, n <= C)` would be like `:nth-child(An+B):nth-child(n <= A*C+B)` or `:nth-child(An+B):nth-child(n >= A*C+B)` depending on the sign of `A`.

This comma-separated syntax is rather confusing to me, because `n <= C` actually means `n <= A*C+B`.

> The former would free authors from doing the math.

It makes it easier if you want to your selector to apply exactly C times, though it doesn't allow to restrict the selection to index C. The question here is what's the more common use case.

Sebastian 

-- 
GitHub Notification of comment by SebastianZ
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4140#issuecomment-517036947 using your GitHub account
Received on Wednesday, 31 July 2019 21:55:02 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:50 UTC