Skip to content

Commit bae4b2b

Browse files
committed
[css-variables-1][editorial] Editorial rewrite of the shorthand parsing/serialization text. No normative change intended.
1 parent 9c1effb commit bae4b2b

File tree

1 file changed

+35
-23
lines changed

1 file changed

+35
-23
lines changed

css-variables-1/Overview.bs

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -753,38 +753,50 @@ Invalid Variables</h3>
753753
<h3 id=variables-in-shorthands>
754754
Variables in Shorthand Properties</h3>
755755

756-
The use of ''var()'' functions in <a>shorthand properties</a> presents some unique difficulties.
757-
758-
For non-custom properties,
759-
the value of a shorthand property is separated out into its component <a>longhand properties</a> at parse time,
760-
and then the longhands themselves participate in the <a>cascade</a>,
761-
with the shorthand more-or-less discarded.
762-
If a ''var()'' functions is used in a shorthand, however,
763-
one can't tell what values are meant to go where;
764-
it may in fact be impossible to separate it out at parse time,
765-
as a single ''var()'' function may substitute in the value of several longhands at once.
766-
767-
To get around this,
768-
implementations must fill in longhands with a special, unobservable-to-authors <dfn export>pending-substitution value</dfn>
756+
''var()'' functions produce some complications
757+
when parsing [=shorthand properties=] into their component longhands,
758+
and when serializing [=shorthand properties=] <em>from</em> their component longhands.
759+
760+
If a [=shorthand property=] contains a ''var()'' function in its value,
761+
the [=longhand properties=] it's associated with must instead be filled in
762+
with a special, unobservable-to-authors <dfn export>pending-substitution value</dfn>
769763
that indicates the shorthand contains a variable,
770-
and thus the longhand's value is pending variable substitution.
764+
and thus the longhand's value can't be determined until variables are [=substituted=].
765+
771766
This value must then be cascaded as normal,
772767
and at computed-value time,
773768
after ''var()'' functions are finally substituted in,
774769
the shorthand must be parsed and the longhands must be given their appropriate values at that point.
775770

776-
<a>Pending-substitution values</a> must be serialized as the empty string,
771+
Note: When a shorthand is written without a ''var()'',
772+
it is parsed and separated out into its component [=longhand properties=] at parse time;
773+
the longhands then participate in the [=cascade=],
774+
with the [=shorthand property=] more or less discarded.
775+
When the shorthand contains a ''var()'', however,
776+
this can't be done,
777+
as the ''var()'' could be substituted with anything.
778+
779+
[=Pending-substitution values=] must be serialized as the empty string,
777780
if an API allows them to be observed.
778781

779-
Similarly,
780-
while [[CSSOM]] defines that shorthand properties are serialized
781-
by appropriately concatenating the values of their corresponding longhands,
782-
shorthands that are specified with explicit ''var()'' functions
783-
must serialize to the original, ''var()''-containing value.
784-
For other shorthands,
785-
if any of the longhand subproperties for that shorthand have <a>pending-substitution values</a>
786-
then the serialized value of the shorthand must be the empty string.
782+
----
783+
784+
[=Shorthand properties=] are serialized
785+
by gathering the values of their component [=longhand properties=],
786+
and synthesizing a value
787+
that will parse into the same set of values.
788+
789+
If all of the component [=longhand properties=] for a given [=shorthand=]
790+
are [=pending-substitution values=]
791+
from the same original shorthand value,
792+
the [=shorthand property=] must serialize to that original
793+
(''var()''-containing)
794+
value.
787795

796+
Otherwise,
797+
if any of the component [=longhand properties=] for a given [=shorthand=]
798+
are [=pending-substitution values=],
799+
the [=shorthand property=] must serialize to the empty string.
788800

789801
<!--
790802
████████ ███████ ███████ ██ ███████ ██ ██ ██████

0 commit comments

Comments
 (0)