Re: [csswg-drafts] [css-values]: Express conditional values in a more terse way (#5009)

Based on my understanding of `cond()` and `switch()`, I'm not yet convinced that they are distinct. But maybe I am _also_ missing something. 😅

- `calc()`/`min()` etc are math functions, validated at parse time
- `var()` requires invalid-at-computed-value-time behavior
- still… we're allowed to use a `var()` inside a `calc()`…

In a similar way, it seems to me that the var-like behavior and the property-limitations of the switch proposal are inherent to the value being queried, not the function itself. Based on my conversations with @bkardell, it sounds like the proposed `available-inline-size` query has certain restrictions, but other future query values might hook into other phases of the rendering lifecycle, with different constraints.

It also seems to me that `cond((100% > 500px) …)` and `switch((available-inline-size > 500px) …)` would _usually_ mean the same thing. The only difference I see is that `100%` takes different meanings in different properties, where `available-inline-size` always means the same thing (but only available in certain properties). 

Is it possible to separate the proposed functions (eg `cond()` or `switch()`) from the element-query values (eg `available-inline-size`), and think of those as distinct features that can be used together in certain ways? Could we have a joined cond/switch function with math-like behavior, and then also provide var-like lifecycle-values with their own limitations-per-property?

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


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

Received on Tuesday, 23 February 2021 23:22:50 UTC