Skip to content

Commit d6674d5

Browse files
nainartabatkins
authored andcommitted
Fix issue 404 (w3c#413)
* Fix issue 404 * add in min()/max() functions * Make sure algo for max() references CSSMathMax not CSSMathMin
1 parent f9dd0c0 commit d6674d5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

css-typed-om/Overview.bs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ are represented by subclasses of the {{CSSNumericValue}} interface.
578578
CSSNumericValue mul(CSSNumberish... values);
579579
CSSNumericValue div(CSSNumberish... values);
580580

581+
CSSNumericValue min(CSSNumberish... values);
582+
CSSNumericValue max(CSSNumberish... values);
583+
581584
boolean equals(CSSNumberish... value);
582585

583586
CSSNumericValue to(DOMString unit);
@@ -705,6 +708,52 @@ The following are the arithmetic operations you can perform on dimensions:
705708
is set to |this|.
706709
</div>
707710

711+
<div algorithm="CSSNumericValue.min()">
712+
The <dfn for=CSSNumericValue method>min(...|values|)</dfn> method,
713+
when called on a {{CSSNumericValue}} |this|,
714+
must perform the following steps:
715+
716+
1. Replace each [=list/item=] of |values|
717+
with the result of [=rectifying a numberish value=] for the [=list/item=].
718+
719+
2. If |this| is a {{CSSMathMin}} object,
720+
[=list/prepend=] the [=list/items=] in |this|’s {{CSSMathMin/values}} internal slot
721+
to |values|.
722+
Otherwise,
723+
prepend |this| to |values|.
724+
725+
3. Let |type| be the result of [=adding=] the [=types=] of every [=list/item=] in |values|.
726+
If |type| is failure,
727+
[=throw=] a {{TypeError}}.
728+
729+
4. Return a new {{CSSMathMin}} object
730+
whose {{CSSMathMin/values}} internal slot
731+
is set to |values|.
732+
</div>
733+
734+
<div algorithm="CSSNumericValue.max()">
735+
The <dfn for=CSSNumericValue method>max(...|values|)</dfn> method,
736+
when called on a {{CSSNumericValue}} |this|,
737+
must perform the following steps:
738+
739+
1. Replace each [=list/item=] of |values|
740+
with the result of [=rectifying a numberish value=] for the [=list/item=].
741+
742+
2. If |this| is a {{CSSMathMax}} object,
743+
[=list/prepend=] the [=list/items=] in |this|’s {{CSSMathMax/values}} internal slot
744+
to |values|.
745+
Otherwise,
746+
prepend |this| to |values|.
747+
748+
3. Let |type| be the result of [=adding=] the [=types=] of every [=list/item=] in |values|.
749+
If |type| is failure,
750+
[=throw=] a {{TypeError}}.
751+
752+
4. Return a new {{CSSMathMax}} object
753+
whose {{CSSMathMax/values}} internal slot
754+
is set to |values|.
755+
</div>
756+
708757
<div class=issue>
709758
Define {{CSSNumericValue/equals()}}.
710759
</div>

0 commit comments

Comments
 (0)