Skip to content

Commit c157ab4

Browse files
committed
[typed-om] Add an 'invert a type' operation.
1 parent 068506b commit c157ab4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

css-typed-om/Overview.bs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,18 @@ is either null or a [=base type=] other than "percent".
18051805
5. Return |finalType|.
18061806
</div>
18071807

1808+
<div algorithm>
1809+
To <dfn export for=CSSNumericValue>invert a type</dfn> |type|,
1810+
perform the following steps:
1811+
1812+
1. Let |result| be a new [=type=]
1813+
with an initially empty [=ordered map=]
1814+
and an initially null [=percent hint=]
1815+
1. [=map/For each=] |unit| → |exponent| of |type|,
1816+
set |result|[|unit|] to (-1 * |exponent|).
1817+
3. Return |result|.
1818+
</div>
1819+
18081820
A [=type=] is said to <dfn export for=CSSNumericValue>match</dfn> a CSS production in some circumstances:
18091821

18101822
* A [=type=] matches <<length>>

0 commit comments

Comments
 (0)