Skip to content

Commit

Permalink
[css-values-4] Clarify in the prose that min/max/round also need all …
Browse files Browse the repository at this point in the history
…their calcs to be the same type. #7496
  • Loading branch information
tabatkins committed Oct 10, 2022
1 parent 627d38b commit 66a3197
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions css-values-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2888,6 +2888,12 @@ Comparison Functions: ''min()'', ''max()'', and ''clamp()''</h3>
(That is, given ''clamp(MIN, VAL, MAX)'',
it represents exactly the same value as ''max(MIN, min(VAL, MAX))'').

For all three functions,
the argument [=calculations=] can resolve to any <<number>>, <<dimension>>, or <<percentage>>,
but must have the <em>same</em> [=determine the type of a calculation|type=],
or else the function is invalid;
the result will have the same [=CSSNumericValue/type=] as the arguments.

<div class="example">

''min()'', ''max()'', and ''clamp()'' can be used to make sure a value doesn't exceed a "safe" limit:
Expand Down Expand Up @@ -3916,7 +3922,8 @@ Type Checking</h3>

* The [=CSSNumericValue/type=] of a ''calc()'' or ''abs()'' expression
is the [=CSSNumericValue/type=] of its contained [=calculation=].
* The [=CSSNumericValue/type=] of a ''min()'', ''max()'', or ''clamp()'' expression
* The [=CSSNumericValue/type=] of a
''min()'', ''max()'', ''clamp()'', ''hypot()'', ''round()'', ''mod()'', or ''rem()'' expression
is the result of [=add two types|adding the types=]
of its comma-separated [=calculations=].
* The [=CSSNumericValue/type=] of a ''sign()'' expression
Expand All @@ -3927,9 +3934,6 @@ Type Checking</h3>
is «[ "angle" → 1 ]».
* The [=CSSNumericValue/type=] of a ''pow()'', ''sqrt()'', ''log()'', or ''exp()'' expression
is «[ "number" → 1 ]».
* The [=CSSNumericValue/type=] of a ''hypot()'', ''round()'', ''mod()'', or ''rem()'' expression
is the result of [=add two types|adding the types=]
of its comma-separated [=calculations=].

For each of the above,
if the [=CSSNumericValue/type=] is failure,
Expand Down

0 comments on commit 66a3197

Please sign in to comment.