W3C home > Mailing lists > Public > public-css-archive@w3.org > October 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: Sat, 19 Oct 2019 23:37:59 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-544206146-1571528278-sysbot+gh@w3.org>
> ... 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 https://github.com/w3c/csswg-drafts/issues/4140#issuecomment-544206146 using your GitHub account
Received on Saturday, 19 October 2019 23:38:01 UTC

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