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
For example, a variable use like <adata-autolink="maybe" class="css">var(foo, red, blue)</a> defines a fallback of <adata-autolink="maybe" class="css">red, blue</a>;
420
420
that is, anything between the first comma and the end of the function is considered a <adata-autolink="link" class="production" href="#fallback-type"><var><fallback></var></a> value.
421
421
422
-
</p><p> If the variable named by the first argument is valid,
423
-
the variable's value is substituted as normal.
424
-
If the variable is invalid,
425
-
and a <adata-autolink="link" class="production" href="#fallback-type"><var><fallback></var></a> was provided,
426
-
the <adata-autolink="link" class="production" href="#fallback-type"><var><fallback></var></a> is substituted instead.
427
-
Otherwise, the result of evaluating the <adata-autolink="maybe" class="css" href="#variable-type">var()</a> function will mean
428
-
that the containing declaration is invalid at computed-value time.
422
+
</p><p> A property value containing a variable must be assumed to be valid at parse time.
423
+
It is only syntax-checked at computed-value time,
424
+
after variable references have been <atitle="resolve a variable" data-autolink="link" href="#resolve-a-variable">resolved</a>.
429
425
430
-
</p><divclass="example">
426
+
</p><p> To <dfnid="resolve-a-variable">resolve a variable</dfn> in a property's value:
427
+
428
+
</p><ol>
429
+
<li>
430
+
If the variable named by the first argument to the <adata-autolink="maybe" class="css" href="#variable-type">var()</a> function is a valid variable,
431
+
replace the <adata-autolink="maybe" class="css" href="#variable-type">var()</a> function by the value of the corresponding <adata-autolink="link" href="#custom-property">custom property</a>.
432
+
433
+
</li><li>
434
+
Otherwise, if the <adata-autolink="maybe" class="css" href="#variable-type">var()</a> function has a <adata-autolink="link" class="production" href="#fallback-type"><var><fallback></var></a> value as its second argument,
435
+
replace the <adata-autolink="maybe" class="css" href="#variable-type">var()</a> function by the <adata-autolink="link" class="production"><var><falback></var></a> value.
436
+
If there are any <adata-autolink="maybe" class="css" href="#variable-type">var()</a> references in the fallback,
437
+
<atitle="resolve a variable" data-autolink="link" href="#resolve-a-variable">resolve</a> them as well.
438
+
439
+
</li><li>
440
+
Otherwise,
441
+
the property containing the <adata-autolink="maybe" class="css" href="#variable-type">var()</a> function is <adata-autolink="link" href="#invalid-at-computed-value-time">invalid at computed-value time</a>.
442
+
443
+
<pclass="note"> Note: Other things can also make a property <adata-autolink="link" href="#invalid-at-computed-value-time">invalid at computed-value time</a>.
444
+
</p></li></ol>
445
+
446
+
<divclass="example">
431
447
The fallback value allows for some types of defensive coding.
0 commit comments