Re: [csswg-drafts] [css-conditional-5] Desugaring @if (#12909)

Yup, a block `@if` has always been my plan when proposing `if()` and `revert-rule` — they are its building blocks to pave the way.

My original idea was that for descendants you can use regular style queries (which would alleviate @tabatkins' concern), but I don't think that can be determined at parse time. I wonder if we can have it late-resolve depending on what the nested rule is targeting. 

Nested rules should definitely not be evaluating a different condition, but that just affects how we define the desugaring. E.g. we could define that it desugars the condition to a `<boolean>` custom property[^1] and then all `if()`s use that custom property instead of the condition verbatim.

[^1]: And add `<boolean>` as type for custom properties, obvs 😁 

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


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

Received on Tuesday, 14 October 2025 04:49:30 UTC