Re: [csswg-drafts] [css-values-5] if() conditions with calc() comparisons (#11104)

Yeah, I think you'd need to use a CQ condition to test something similar to that; we need to be able to resolve the condition at computed-value time. I suppose we'd just say that the condition is always false if it uses values that can't be resolved at computed-value time.

I was hoping that `if()` would subsume the need for a conditional math function, but I guess it doesn't. :/ Gonna be a little hard to explain when exactly `calc-if()` is needed, unfortunately.

--------

An additional request: the *other* thing brought up as a common conditional need is just comparing a value to an ident, so you can set a custom property on a component like `--style: button` and it'll do different things.

I think we can just slot that into the parenthesized syntax, with an `<ident> [ '=' | '!' '=' ] <ident>` form. It overlaps grammatically with the calc-sum version when you compare calc keywords with each other, but it would resolve the same under either interpretation, so that's fine.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11104#issuecomment-2444937719 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:37:06 UTC