- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Fri, 15 Dec 2023 15:08:02 +0000
- To: public-css-archive@w3.org
LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-values] Make min and max value optional in `clamp()` == As we know, we added `clamp()` because doing clamping logic with `min()` and `max()` is counterintuitive. However, this doesn't only apply when you have *both* a min and a max, it’s _still_ counterintuitive when you only have one of two. I keep finding myself using `clamp()` with dummy min or max values so that I can only use it for max or min respectively, which not only adds cognitive overhead, but also pointless computation. A nice little improvement could be to make the min and max values optional, either via allowing empty tokens (ideal) or `none` keywords. Before: ``` <clamp()> = clamp( <calc-sum>#{3} ) ``` After: ``` <clamp()> = clamp( <calc-sum>? , <calc-sum> , <calc-sum>? ) ``` Note that this is different from `clamp( <calc-sum>#{2, 3} )`: we still need empty tokens for the missing arguments, otherwise we wouldn't be able to disambiguate. I.e. `clamp(3rem, 10vh)` would not be valid, it would need to be either `clamp(3rem, 10vh, )` or `clamp( , 3rem, 10vh)`. Hopefully this is such a small change we may be able to wedge it in css-values-4. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9713 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 15 December 2023 15:08:04 UTC