You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Cascading Variables: the <spanclass=cssdata-link-type=maybe>var()</span> notation</a><ulclass=toc><li><ahref=#invalid-variables><spanclass=secno>3.1</span>
<pclass=note> Note: Custom properties can contain a trailing <spanclass=cssdata-link-type=maybe>!important</span>,
236
+
<pclass=note> Note: Custom properties can contain a trailing <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-cascade-3/#important>!important</a>,
236
237
but this is automatically removed from the property’s value by the CSS parser,
237
238
and makes the custom property "important" in the CSS cascade.
238
239
In other words, the prohibition on top-level "!" characters
239
-
does not prevent <spanclass=cssdata-link-type=maybe>!important</span> from being used,
240
-
as the <spanclass=cssdata-link-type=maybe>!important</span> is removed before syntax checking happens.
240
+
does not prevent <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-cascade-3/#important>!important</a> from being used,
241
+
as the <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-cascade-3/#important>!important</a> is removed before syntax checking happens.
241
242
242
243
<pclass=note> Note: While <aclass=productiondata-link-type=typehref=#typedef-any-value><any-value></a> must represent at least one token,
Variables in Shorthand Properties</span><aclass=self-linkhref=#variables-in-shorthands></a></h3>
618
+
619
+
<p> The use of <ahref=#cascading-variable>variables</a> in <ahref=http://dev.w3.org/csswg/css-cascade-3/#shorthand-properties>shorthand properties</a> presents some unique difficulties.
620
+
621
+
<p> Ordinarily, the value of a shorthand property is separated out into its component <ahref=http://dev.w3.org/csswg/css-cascade-3/#longhand-sub-properties>longhand properties</a> at parse time,
622
+
and then the longhands themselves participate in the <ahref=http://dev.w3.org/csswg/css-cascade-3/#cascade>cascade</a>,
623
+
with the shorthand more-or-less discarded.
624
+
If a <ahref=#cascading-variable>variable</a> is used in a shorthand, however,
625
+
one can’t tell what values are meant to go where;
626
+
it may in fact be impossible to separate it out at parse time,
627
+
as a single <ahref=#cascading-variable>variable</a> may substitute in the value of several longhands at once.
628
+
629
+
<p> To get around this,
630
+
implementations must fill in longhands with a special, unobservable-to-authors <dfndata-dfn-type=dfndata-export="" id=pending-variable-substitution-value>pending variable-substitution value<aclass=self-linkhref=#pending-variable-substitution-value></a></dfn>
631
+
that indicates the shorthand contains a variable,
632
+
and thus the longhand’s value is pending variable substitution.
633
+
This value must then be cascaded as normal,
634
+
and at computed-value time,
635
+
after <ahref=#cascading-variable>variables</a> are finally substituted in,
636
+
the shorthand must be parsed and the longhands must be given their appropriate values at that point.
637
+
638
+
<p><ahref=#pending-variable-substitution-value>Pending variable-substitution values</a> must be serialized as the empty string,
639
+
if an API allows them to be observed.
640
+
641
+
<p> Similarly,
642
+
while <adata-biblio-type=informativedata-link-type=bibliohref=#cssomtitle=CSSOM>[CSSOM]</a> defines that shorthand properties are serialized
643
+
by appropriately concatenating the values of their corresponding longhands,
644
+
shorthands containing <ahref=#cascading-variable>variables</a> must instead retain their original, <aclass=cssdata-link-type=maybehref=#funcdef-var>var()</a>-containing, value.
645
+
If serializing a shorthand’s value would involve serializing a <ahref=#pending-variable-substitution-value>pending variable-substitution value</a>,
646
+
the shorthand must instead be serialized by serializing its original value.
<divdata-fill-with=informative-references><dl><dtid=css3colortitle=CSS3COLOR><aclass=self-linkhref=#css3color></a>[CSS3COLOR]<dd>Tantek Çelik; Chris Lilley; L. David Baron. <ahref=http://www.w3.org/TR/2011/REC-css3-color-20110607>CSS Color Module Level 3</a>. 7 June 2011. W3C Recommendation. URL: <ahref=http://www.w3.org/TR/2011/REC-css3-color-20110607>http://www.w3.org/TR/2011/REC-css3-color-20110607</a></dl></div>
983
+
<divdata-fill-with=informative-references><dl><dtid=css3colortitle=CSS3COLOR><aclass=self-linkhref=#css3color></a>[CSS3COLOR]<dd>Tantek Çelik; Chris Lilley; L. David Baron. <ahref=http://www.w3.org/TR/2011/REC-css3-color-20110607>CSS Color Module Level 3</a>. 7 June 2011. W3C Recommendation. URL: <ahref=http://www.w3.org/TR/2011/REC-css3-color-20110607>http://www.w3.org/TR/2011/REC-css3-color-20110607</a><dtid=cssomtitle=CSSOM><aclass=self-linkhref=#cssom></a>[CSSOM]<dd>Anne van Kesteren. <ahref=http://www.w3.org/TR/2011/WD-cssom-20110712/>CSSOM</a>. 12 July 2011. W3C Working Draft. (Work in progress.) URL: <ahref=http://www.w3.org/TR/2011/WD-cssom-20110712/>http://www.w3.org/TR/2011/WD-cssom-20110712/</a></dl></div>
0 commit comments