Skip to content

Commit 310f48a

Browse files
committed
[css-syntax-3][css-variables-1][editorial] Clarify that the comment-insertion can happen with 0+ comments between the original tokens, not exactly 1. Add an example to Variables talking about this. w3c#7328
1 parent b1e59ad commit 310f48a

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

css-syntax-3/Overview.bs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3663,7 +3663,8 @@ Serialization</h2>
36633663
the pair of tokens must be serialized with a comment between them.
36643664

36653665
If the tokenizer preserves comments,
3666-
the preserved comment should be used;
3666+
and there were comments originally between the token pair,
3667+
the preserved comment(s) should be used;
36673668
otherwise, an empty comment (<code>/**/</code>) must be inserted.
36683669
(Preserved comments may be reinserted even if the following tables don't require a comment between two tokens.)
36693670

css-variables-1/Overview.bs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,25 @@ Using Cascading Variables: the ''var()'' notation</h2>
905905
margin-top: calc(var(--gap) * 1px);
906906
}
907907
</pre>
908+
909+
This also implies that the post-substitution value
910+
might not be directly serializable as-is.
911+
Here's a similar example to the preceding:
912+
913+
<pre>
914+
.foo {
915+
--gap: 20;
916+
--not-px-length: var(--gap)px;
917+
}
918+
</pre>
919+
920+
The serialization of the computed (post-subsitution)
921+
value of ''--not-px-length''
922+
is <strong>not</strong> ''20px'',
923+
because that would parse back as the single combined dimension;
924+
instead, it will serialize with a comment between the two tokens,
925+
like ''20/**/px'',
926+
to enforce that they are separate tokens even when re-parsing.
908927
</div>
909928

910929
<wpt>

0 commit comments

Comments
 (0)