Re: [csswg-drafts] [css-values-5] Introduce nth-item() (#11103)

Since other indexed things in CSS (grid lines, notably) allow counting from the end with negative values, presumably we'd do the same. 0 would just be invalid (or clamped to 1, if we add the clamp option).

Selecting by random requires the fuller handling of random caching that `random-item()` provides. In theory it's possible to merge in the grammar, but in practice it would be more trouble than it's worth.

Selecting by key should be handleable by `if()`, with a touch more verbosity (you'd repeat the var() in each branch). If that ends up being too verbose because you're doing it a lot, `nth-item()` is already the intended way to fix that (use an `if()` to select an integer in one place, then use the integer to index a bunch of lists).

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


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

Received on Tuesday, 29 October 2024 17:28:02 UTC