@@ -868,6 +868,34 @@ The ordering of a [=type=]’s entries always matches this [=base type=] orderin
868
868
The <dfn for=CSSNumericValue>percent hint</dfn>
869
869
is either null or a [=base type=] other than "percent".
870
870
871
+ <div algorithm>
872
+ To <dfn lt="create a type|creating a type">create a type</dfn> from a string |unit|,
873
+ follow the appropriate branch of the following:
874
+
875
+ <dl class=switch>
876
+ : |unit| is "number"
877
+ :: Return «[ ] » (empty map)
878
+ : |unit| is "percent"
879
+ :: Return «[ "percent" → 1 ] »
880
+ : |unit| is a <<length>> unit
881
+ :: Return «[ "length" → 1 ] »
882
+ : |unit| is an <<angle>> unit
883
+ :: Return «[ "angle" → 1 ] »
884
+ : |unit| is a <<time>> unit
885
+ :: Return «[ "time" → 1 ] »
886
+ : |unit| is a <<frequency>> unit
887
+ :: Return «[ "frequence" → 1 ] »
888
+ : |unit| is a <<resolution>> unit
889
+ :: Return «[ "resolution" → 1 ] »
890
+ : |unit| is a <<flex>> unit
891
+ :: Return «[ "flex" → 1 ] »
892
+ : anything else
893
+ :: Return failure.
894
+ </dl>
895
+
896
+ In all cases, the associated [=percent hint=] is null.
897
+ </div>
898
+
871
899
<div algorithm>
872
900
To <dfn local-lt="add | addition">add two types</dfn> |type1| and |type2|,
873
901
perform the following steps:
@@ -1050,7 +1078,7 @@ are represented as {{CSSUnitValue}}s.
1050
1078
when called,
1051
1079
perform the following steps:
1052
1080
1053
- 1. If |unit| does not have a [=CSS type=] ,
1081
+ 1. If [=creating a type=] from |unit| returns failure ,
1054
1082
[=throw=] a {{SyntaxError}}
1055
1083
and abort this algorithm.
1056
1084
@@ -1064,7 +1092,7 @@ are represented as {{CSSUnitValue}}s.
1064
1092
on setting a value |unit|,
1065
1093
perform the following steps:
1066
1094
1067
- 1. If |unit| does not have a [=CSS type=] ,
1095
+ 1. If [=creating a type=] from |unit| returns failure, ,
1068
1096
[=throw=] a {{TypeError}} .
1069
1097
1070
1098
2. Otherwise,
@@ -1081,32 +1109,9 @@ are represented as {{CSSUnitValue}}s.
1081
1109
Issue: Figure out how we're exposing types. This should probably move up to the superclass, then.
1082
1110
</div>
1083
1111
1084
- <div algorithm="CSS type of a unit">
1085
- The [=type=] of a {{CSSUnitValue}}
1086
- depends on its {{CSSUnitValue/unit}} as follows:
1087
-
1088
- <dl class=switch>
1089
- : |unit| is "number"
1090
- :: [=type=] is «[ ] » (empty map)
1091
- : |unit| is "percent"
1092
- :: [=type=] is «[ "percent" → 1 ] »
1093
- : |unit| is a <<length>> unit
1094
- :: [=type=] is «[ "length" → 1 ] »
1095
- : |unit| is an <<angle>> unit
1096
- :: [=type=] is «[ "angle" → 1 ] »
1097
- : |unit| is a <<time>> unit
1098
- :: [=type=] is «[ "time" → 1 ] »
1099
- : |unit| is a <<frequency>> unit
1100
- :: [=type=] is «[ "frequence" → 1 ] »
1101
- : |unit| is a <<resolution>> unit
1102
- :: [=type=] is «[ "resolution" → 1 ] »
1103
- : |unit| is a <<flex>> unit
1104
- :: [=type=] is «[ "flex" → 1 ] »
1105
- : anything else
1106
- :: the string does not have a [=CSS type=]
1107
- </dl>
1108
-
1109
- In all cases, the [=percent hint=] of the [=type=] is null.
1112
+ <div algorithm>
1113
+ The <dfn>[=type=] of a {{CSSUnitValue}}</dfn>
1114
+ is the result of [=creating a type=] from its {{CSSUnitValue/unit}} internal slot.
1110
1115
</div>
1111
1116
1112
1117
<div algorithm>
0 commit comments