Skip to content

Commit c210c47

Browse files
committed
Serialize keywords and unit values more explicitly.
1 parent 6bcbd14 commit c210c47

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

css-typed-om/Overview.bs

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,7 @@ length3.toString(); // "42px";
30483048
</div>
30493049

30503050
<div algorithm>
3051-
To <dfn>serialize a {{CSSVariableReferenceValue}}</dfn> |this|:
3051+
To <dfn export>serialize a {{CSSVariableReferenceValue}}</dfn> |this|:
30523052

30533053
1. Let |s| initally be the [=string=] "var(".
30543054

@@ -3063,28 +3063,40 @@ length3.toString(); // "42px";
30633063
and return |s|.
30643064
</div>
30653065

3066+
30663067
{{CSSKeywordValue}} Serialization {#keywordvalue-serialization}
30673068
---------------------------------------------------------------
30683069

3069-
{{CSSKeywordValue}} objects are serialized to their contained
3070-
{{CSSKeywordValue/value}} attribute.
3070+
<div algorithm>
3071+
To <dfn export>serialize a {{CSSKeywordValue}}</dfn> |this|:
3072+
3073+
1. Return |this|’s {{CSSKeywordValue/value}} internal slot.
3074+
</div>
3075+
30713076

30723077
{{CSSUnitValue}} Serialization {#numericvalue-serialization}
3073-
--------------------------------------------------------------
3078+
------------------------------------------------------------
30743079

3075-
If their {{CSSUnitValue/unit}} is "number",
3076-
{{CSSUnitValue}} objects are serialized
3077-
to the string representation of their {{CSSUnitValue/value}}.
3080+
<div algorithm>
3081+
To <dfn export>serialize a {{CSSUnitValue}}</dfn> |this|:
3082+
3083+
1. Let |value| and |unit| be
3084+
|this|‘s {{CSSUnitValue/value}} and {{CSSUnitValue/unit}} internal slots.
3085+
3086+
2. Set |s| to the result of serializing a <<number>> from |value|,
3087+
per [[cssom#serializing-css-values]].
30783088

3079-
Otherwise, if their {{CSSUnitValue/unit}} is "percent",
3080-
{{CSSUnitValue}} objects are serialized
3081-
to the string representation of their {{CSSUnitValue/value}}
3082-
followed by the character U+0025 PERCENTAGE SIGN (%).
3089+
3. If |unit| is "number",
3090+
return |s|.
3091+
3092+
4. Otherwise, if |unit| is "percentage",
3093+
append "%" to |s|,
3094+
then return |s|.
3095+
3096+
5. Otherwise, append |unit| to |s|,
3097+
then return |s|.
3098+
</div>
30833099

3084-
Otherwise,
3085-
{{CSSUnitValue}} objects are serialized
3086-
to the string representation of their {{CSSUnitValue/value}}
3087-
followed by their {{CSSUnitValue/unit}}.
30883100

30893101
{{CSSMathValue}} Serialization {#calc-serialization}
30903102
---------------------------------------------------------

0 commit comments

Comments
 (0)