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

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