-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-values-5] if() conditions with calc() comparisons #11104
Comments
Currently all the conditions in
This way you can write, say, (or, spread over multiple lines:
) |
width: if( (100% > 200px): max-content; else : stretch; ); So I guess it needs to be invalid? But it would be cool to have an width: if( (100% > 200px): 1em; else : 1lh; );
/* behaves like this: */
width: calc(max(0, sign(100% - 200px)) * 1em + (1 - max(0, sign(100% - 200px))) * 1lh) |
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 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 I think we can just slot that into the parenthesized syntax, with an |
Why do we need the parens at all? What kind of ambiguity exists if we can simply use bare comparisons? Also, at first, we should probably expand the syntax of |
You need parens to work with the We could, in theory, let you omit the parens if you were just doing a single comparison on its own. But then you'd need to add them if you did
That's something for Containment to define; |
Just to add, this would make it possible to use Currently, there is no way to do something like |
Several of the examples in #5009 were comparing
<length>
values, but this was not included in #10064Do we want this functionality, and if so what are the use cases and what should be the syntax?
Currently specced conditionals are:
The text was updated successfully, but these errors were encountered: