Re: [csswg-drafts] [css-values] Make it explicit that min(), max(), clamp() require arguments to have the same type (#7496)

> one cannot get a `<number>` type result from a `clamp()`

You can, if the arguments are `<number>`s. Like in `clamp(0, (100vw - 1024px) / 1px, 1)`, but see below.

> both by necessity result in a `<length>`

The 1st one is a `<length>`. The 2nd one mixes length and percentage arguments, so it will be a `<length-percentage>` in properties like `width` that resolve percentages against lengths, or it will be invalid in properties like `opacity`.

> 0px or 1px

The numeric part of a length is not necessarily integral, you can also get `0.5px` and such. So this is not good for boolean logic.

> one SHOULDN'T be able to get what amounts to a boolean test

`clamp()` is not the right tool for that, `sign()` is better: #4673, https://github.com/w3c/csswg-drafts/issues/4731#issuecomment-581312064

> why not permit `hidden`/`visible` or `relative`/`absolute` as the result?

You mean keywords? Thanks to `sign()` you can use arithmetic to fake conditionals with numeric values, but keywords will probably have to wait for proper conditionals.


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


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

Received on Sunday, 28 August 2022 13:25:28 UTC