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

> ... But as @Crissov says the proposals represent different use cases, or maybe different ways of thinking.
> Then `:nth-child(2n <= 8)` represents "Match every even element up to the eighth", but `:nth-child(2n, n <= 4)` means "Match the first 4 even elements".

Right, those are two different ways of thinking. My approach focuses on the indexes of the elements while your one focuses on the number of elements to be styled.
So @Crissov is right, both are legitimate and cover different use cases.

> @tabatkins "the fact that N goes over 0-Inf is already kinda confusing". Precisely, if we put a condition on `n`, authors can override this confusing behaviour with another one that makes more sense for them. Adding conditions on the result of `an+b` would presumably keep `n >= 0`, so it may become even more confusing.

I believe the fact that n is in the range of 0 to infinity is not the issue here. People knowing other languages already know this from array indexes. The hard part of the current syntax is that n isn't the actual index and you have to calculate the index using it.


GitHub Notification of comment by SebastianZ
Please view or discuss this issue at using your GitHub account

Received on Saturday, 19 October 2019 23:38:01 UTC