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

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values] Make it explicit that min(), max(), clamp() require arguments to have the same type   ==
`round()`, `mod()`, `rem()`, `hypot()` are defined with

> The argument calculations can resolve to any [`<number>`](https://drafts.csswg.org/css-values-4/#number-value), [`<dimension>`](https://drafts.csswg.org/css-values-4/#typedef-dimension), or [`<percentage>`](https://drafts.csswg.org/css-values-4/#percentage-value), but must have the same [type](https://drafts.csswg.org/css-values-4/#determine-the-type-of-a-calculation), or else the function is invalid; the result will have the same [type](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-type) as the arguments.

I think the same applies to `min()`, `max()` and `clamp()`, but https://drafts.csswg.org/css-values-4/#comp-func doesn't say that.

It may not be actually needed, since https://drafts.csswg.org/css-values-4/#calc-type-checking already says

> - The [type](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-type) of a [min()](https://drafts.csswg.org/css-values-4/#funcdef-min), [max()](https://drafts.csswg.org/css-values-4/#funcdef-max), or [clamp()](https://drafts.csswg.org/css-values-4/#funcdef-clamp) expression is the result of [adding the types](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-add-two-types) of its comma-separated [calculations](https://drafts.csswg.org/css-values-4/#calc-calculation).
> 
> For each of the above, if the [type](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-type) is failure, the [math function](https://drafts.csswg.org/css-values-4/#math-function) is invalid.

But for `round()`, `mod()`, `rem()` and `hypot()` it's stated in both places and it's more clear. So I would do the same for `min()`, `max()` and `clamp()`.

Also, these could be merged:

> - The [type](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-type) of a [min()](https://drafts.csswg.org/css-values-4/#funcdef-min), [max()](https://drafts.csswg.org/css-values-4/#funcdef-max), or [clamp()](https://drafts.csswg.org/css-values-4/#funcdef-clamp) expression is the result of [adding the types](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-add-two-types) of its comma-separated [calculations](https://drafts.csswg.org/css-values-4/#calc-calculation).
> - The [type](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-type) of a [hypot()](https://drafts.csswg.org/css-values-4/#funcdef-hypot), [round()](https://drafts.csswg.org/css-values-4/#funcdef-round), [mod()](https://drafts.csswg.org/css-values-4/#funcdef-mod), or [rem()](https://drafts.csswg.org/css-values-4/#funcdef-rem) expression is the result of [adding the types](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-add-two-types) of its comma-separated [calculations](https://drafts.csswg.org/css-values-4/#calc-calculation).

or separate `hypot()` (exponential function) from the stepped value functions.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7496 using your GitHub account


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

Received on Thursday, 14 July 2022 12:29:28 UTC