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

Yeah, so, proposal:

```
if( <if-clause># )
<if-clause> = <if-condition> ':' <declaration-value>?
<if-condition> = <boolean> | else
```

The function resolves to the `<declaration-value>` of the first `<if-clause>` with a matching condition. `else` is a condition that always matches; usually you'll put it at the end, but that's not required.

If nothing matches, it resolves to nothing (an empty token stream). (No built-in way to make the function *itself* trigger IACVT, don't think that's particularly needed. There are ways to trigger that if you want it, like referring to a non-existent variable.)

The resolution of #9539 will have a small impact on this; if we resolve to go with {} wrappers, then this is all fine; if we stick with upgradeable commas, then we'll want to allow a final trailing comma/semicolon.

I think this proposal is satisfactory to Lea, from our earlier conversation? The only thing I believe she still has a mild disagreement with is that she prefers using `?` instead of `:` for the separator between condition and value, but would be fine either way. (And fwiw, I'm identical, just with the opposite preference.)

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


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

Received on Tuesday, 24 September 2024 23:42:31 UTC