[csswg-drafts] [css-conditional][css-values] Allow setting type for style() condition comparisons (#12330)

mirisuzanne has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-conditional][css-values] Allow setting type for style() condition comparisons ==
The `style()` condition in `@container` and `if()` behaves differently depending on the type of the custom property being queried. If `--color` is registered with the `<color>` syntax, and `--token` is not, but both are assigned the `red` value, then `style(--color: #f00)` will be true, and `style(--token: #f00)` will be false. 

Ideally, authors should be able to assign a type _for the condition_ instead of relying on the registration of individual properties. I raised this on [a separate issue](https://github.com/w3c/csswg-drafts/issues/12315#issuecomment-2963322914) about function parameter types, and @tabatkins suggested `--foo as <type>: val` for a syntax. This should also work in a range syntax: `10px < --foo as <length> < 20px`.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12330 using your GitHub account


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

Received on Thursday, 12 June 2025 15:57:44 UTC