@@ -1034,6 +1034,12 @@ For the purposes of [=matching=],
1034
1034
these cases should be treated as <<length-percentage>> .
1035
1035
Similarly for <<angle-percentage>> , etc.
1036
1036
1037
+ Note: [=Types=] form a semi-group under both addition and multiplication,
1038
+ meaning that they're associative and commutative.
1039
+ Thus the spec can, for example,
1040
+ [=add=] an unbounded number of types together unambiguously,
1041
+ rather than having to manually [=add=] them pair-wise.
1042
+
1037
1043
1038
1044
1039
1045
<!--
@@ -1268,32 +1274,26 @@ of all the "math" operations.
1268
1274
2. If |args| [=list/is empty=] ,
1269
1275
[=throw=] a {{SyntaxError}} .
1270
1276
1271
- 3. Let |strongType| initially be null.
1272
-
1273
- 4. Let |values| be an initially empty [=list=] .
1274
-
1275
- 5. [=list/For each=] |arg| of |args|:
1276
-
1277
- 1. If |arg| has a [=strong type=] , and |strongType| is null,
1278
- let |strongType| by |arg|’s [=strong type=] .
1279
-
1280
- 2. If |arg| has a [=strong type=] ,
1281
- and |strongType| is not equal to that type,
1282
- [=throw=] a {{TypeError}} .
1283
-
1284
- 3. [=list/Append=] |arg| to |values|.
1277
+ 3. Let |type| be the result of [=adding=] the [=types=] of all the [=list/items=] of |args|.
1278
+ If |type| is failure,
1279
+ [=throw=] a {{SyntaxError}} .
1285
1280
1286
- 6 . Return a new {{CSSMathSum}}
1281
+ 4 . Return a new {{CSSMathSum}}
1287
1282
whose {{CSSMathSum/values}} internal slot
1288
- is set to |values |.
1283
+ is set to |args |.
1289
1284
1290
- The <dfn constructor for="CSSMathProduct">CSSMathProduct(...|args|)</dfn> ,
1291
- <dfn constructor for="CSSMathMin">CSSMathMin(...|args|)</dfn> ,
1285
+ The <dfn constructor for="CSSMathMin">CSSMathMin(...|args|)</dfn>
1292
1286
and <dfn constructor for="CSSMathMax">CSSMathMax(...|args|)</dfn> constructors
1293
1287
are defined identically to the above,
1294
1288
except that in the last step
1295
- they return a new {{CSSMathProduct}} , {{ CSSMathMin}}, or {{CSSMathMax}} object,
1289
+ they return a new {{CSSMathMin}} or {{CSSMathMax}} object,
1296
1290
respectively.
1291
+
1292
+ The <dfn constructor for="CSSMathProduct">CSSMathProduct(...|args|)</dfn> constructor
1293
+ is defined identically to the above,
1294
+ except that in step 3 it [=multiplies=] the types instead of [=adding=] ,
1295
+ and in the last step
1296
+ it returns a {{CSSMathProduct}} .
1297
1297
</div>
1298
1298
1299
1299
<div algorithm="CSSMathNegate(arg)">
@@ -1314,6 +1314,27 @@ of all the "math" operations.
1314
1314
it returns a new {{CSSMathInvert}} object.
1315
1315
</div>
1316
1316
1317
+ <div algorithm>
1318
+ The <dfn>[=type=] of a CSSMathValue</dfn>
1319
+ depends on its class:
1320
+
1321
+ <dl class=switch>
1322
+ : {{CSSMathSum}}
1323
+ : {{CSSMathMin}}
1324
+ : {{CSSMathMax}}
1325
+ :: The [=type=] is the result of [=adding=] the [=types=]
1326
+ of each of the [=list/items=] in its {{CSSMathSum/values}} internal slot.
1327
+
1328
+ : {{CSSMathProduct}}
1329
+ :: The [=type=] is the result of [=multiplying=] the [=types=]
1330
+ of each of the [=list/items=] in its {{CSSMathProduct/values}} internal slot.
1331
+
1332
+ : {{CSSMathNegate}}
1333
+ : {{CSSMathInvert}}
1334
+ :: The [=type=] is the same as the [=type=] of its {{CSSMathNegate/value}} internal slot,
1335
+ but with all [=map/values=] negated.
1336
+ </dl>
1337
+ </div>
1317
1338
1318
1339
1319
1340
<!--
0 commit comments