@@ -742,20 +742,12 @@ The following are the arithmetic operations you can perform on dimensions:
742742 3. If |sum| has more than one [=list/item=] ,
743743 [=throw=] a {{TypeError}} .
744744 Otherwise, let |item| be the result of [=create a CSSUnitValue from a sum value item|creating a CSSUnitValue=]
745- from the sole [=list/item=] in |sum|.
745+ from the sole [=list/item=] in |sum|,
746+ then [=converting a CSSUnitValue|converting=] it to |unit|.
746747 If |item| is failure,
747748 [=throw=] a {{TypeError}} .
748749
749- 4. If |unit| and |item|’s {{CSSUnitValue/unit}} internal slot are not [=compatible units=] ,
750- [=throw=] a {{TypeError}} .
751-
752- 5. If |unit| is not equal to |item|’s {{CSSUnitValue/unit}} internal slot,
753- multiply |item|’s {{CSSUnitValue/value}} internal slot
754- by the conversion ratio between the two units,
755- and set its {{CSSUnitValue/unit}} internal slot
756- to |unit|.
757-
758- 6. Return |item|.
750+ 4. Return |item|.
759751</div>
760752
761753<div algorithm>
@@ -1274,7 +1266,7 @@ are represented as {{CSSUnitValue}}s.
12741266</div>
12751267
12761268<div algorithm>
1277- When asked to <dfn export>create a CSSUnitValue from a string</dfn> |str|,
1269+ To <dfn export>create a CSSUnitValue from a string</dfn> |str|,
12781270 return a new {{CSSUnitValue}} object
12791271 with its {{CSSUnitValue/value}} internal slot
12801272 set to the numeric portion of |str| parsed into a number,
@@ -1289,6 +1281,25 @@ are represented as {{CSSUnitValue}}s.
12891281 </div>
12901282</div>
12911283
1284+ <div algorithm>
1285+ To <dfn export>convert a CSSUnitValue</dfn> |this| to a unit |unit|,
1286+ perform the following steps:
1287+
1288+ 1. Let |old unit| be the value of |this|’s {{CSSUnitValue/unit}} internal slot,
1289+ and |old value| be the value of |this|’s {{CSSUnitValue/value}} internal slot.
1290+
1291+ 2. If |old unit| and |unit| are not [=compatible units=] ,
1292+ return failure.
1293+
1294+ 3. Return a new {{CSSUnitValue}}
1295+ whose {{CSSUnitValue/unit}} internal slot
1296+ is set to |unit|,
1297+ and whose {{CSSUnitValue/value}} internal slot
1298+ is set to |old value| multiplied by
1299+ the conversation ratio between |old unit| and |unit|.
1300+ </div>
1301+
1302+
12921303
12931304<!--
12941305 ██████ ███ ██ ██████ ███ ███
0 commit comments