Re: [csswg-drafts] [css-values-5] What is the MVP for inline conditionals on custom properties? (#10064)

>  `if([cond ? iftrue : iffalse ]+)`

I guess, it should have the `#` with the comma-semicolon thing we decided earlier? (`+` will be repeating it with space, `#` with commas, see https://drafts.csswg.org/css-values-4/#component-multipliers)

Overall, I like the `if(a ? b : c)` syntax, as the ternaries are common, and we can't use it without the wrapping `if()` due to the `:` being significant in CSS syntax.

That said, I wonder if we could do this similarly with `calc()`, where we could allow using the ternaries in some other contexts without using the wrapping `if()`? Like we can use calculations without `calc()` inside things like `clamp()` and `round()`, we could allow using ternaries inside `calc()` and anything similar.

---

Re: empty value, I think we should allow just omitting the value with optional whitespace to follow how the `--foo:;` and `var(--foo,)` work now: so the `if(a?b:)` and `if(a?:b)` should work fine.

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


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

Received on Tuesday, 18 June 2024 14:13:01 UTC