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

Hi @tabatkins, I was not in the breakout, but added the filter proposal to the tables.

In my opinion it reads way more naturally than the ranges, so I would like to see it discussed at least, especially since I proposed it before the breakout :) I would not object to a consensus from the group of course, but I don't know how many people made it to the breakout in the end, and if they saw my comment.

I just did mini tables based on the consensus proposal:

### Match the first three elements
| | **Match the first three elements** |
|------------------------|--------------------------------|
| breakout syntax  | `:nth-child(n <= 3)`           |
| filter syntax          | `:nth-child(first 3)`          |

### Match every even element up to the eighth <br>/ match every even element up to four 

| | **Match every even element up to the eighth <br>/ match every even element up to four** 
|------------------------|--------------------------------|
| breakout syntax  | `:nth-child(n <= 4 of :nth-child(even))` or `:nth-child(n <= 8):nth-child(even)`
| filter syntax          | `:nth-child(even, first 4)` or `:nth-child(first 8, even)`

### Match every third element between the sixth and the fifteenth <br>/ match every third element up to four starting at the sixth

| | **Match every third element between the sixth and the fifteenth <br>/ match every third element up to four starting at the sixth** |
|------------------------|--------------------------------|
| breakout syntax  | `:nth-child(6 <= n <= 15):nth-child(3n)`
| filter syntax          | `:nth-child(3n, skip 1, first 4)` or `:nth-child(first 15, 3n, not first 1)`

### Match every third element starting with the second one and ending at the third last

| | **Match every third element starting with the second one and ending at the third last**                                                             |
|------------------------|--------------------------------|
| breakout syntax  | `:nth-last-child(n >= 3 of :nth-child(n >= 2 of :nth-child(3n)))`
| filter syntax          | `:nth-child(3n, not first 2, not last 2)`

-- 
GitHub Notification of comment by FremyCompany
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4140#issuecomment-1645567195 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 21 July 2023 13:13:00 UTC