Re: [csswg-drafts] [css-values]: Expose `n` as a `<calc-constant>` (#8981)

We cannot make values dependent on what kind of selector they were applied with. That information is lost immediately in the cascade; it also makes things like inheritance weird, or setting a value via the OM. It's also simply not well-defined - there can be multiple :nth-child() expressions in a selector.

Exposing a way to access the sibling index of an element is theoretically possible, but would need to be done directly via some new function. We haven't done it so far because it has the side-effect of defeating a lot of style-sharing optimizations, since the styles become more specialized to the precise element they're on.

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


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

Received on Saturday, 17 June 2023 15:24:07 UTC