Skip to content

Commit 8697740

Browse files
committed
[css-variables] Specify that the first argument of var() must be an ident.
1 parent 10c2afc commit 8697740

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

css-variables/Overview.html

+16-16
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ <h2 data-level=2 id=defining-variables><span class=secno>2 </span><span class=co
181181

182182
<div class=example>
183183
Custom properties define variables,
184-
referenced with the <a class=css data-link-type=maybe href=#variable-type>var()</a> notation,
184+
referenced with the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> notation,
185185
which can be used for many purposes.
186186
For example, a page that consistently uses a small set of colors in its design
187187
can store the colors in custom properties
@@ -269,8 +269,8 @@ <h3 data-level=2.1 id=syntax><span class=secno>2.1 </span><span class=content>
269269

270270
<p> The initial value of a <a href=#custom-property>custom property</a> is an empty value;
271271
that is, nothing at all.
272-
This initial value has a special interaction with the <a class=css data-link-type=maybe href=#variable-type>var()</a> notation,
273-
which is explained in the section defining <a class=css data-link-type=maybe href=#variable-type>var()</a>.
272+
This initial value has a special interaction with the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> notation,
273+
which is explained in the section defining <a class=css data-link-type=maybe href=#funcdef-var>var()</a>.
274274

275275
<h3 data-level=2.2 id=using><span class=secno>2.2 </span><span class=content>
276276
Using Custom Properties</span><a class=section-link href=#using>§</a></h3>
@@ -434,13 +434,13 @@ <h3 data-level=2.3 id=cycles><span class=secno>2.3 </span><span class=content>
434434

435435

436436
<h2 data-level=3 id=using-variables><span class=secno>3 </span><span class=content>
437-
Using Cascading Variables: the <a class=css data-link-type=maybe href=#variable-type>var()</a> notation</span><a class=section-link href=#using-variables>§</a></h2>
437+
Using Cascading Variables: the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> notation</span><a class=section-link href=#using-variables>§</a></h2>
438438

439439
<p> Every <a href=#custom-property>custom property</a> automatically defines a corresponding <a href=#cascading-variable>cascading variable</a>,
440-
which can then be substituted into another property with the <a class=css data-link-type=maybe href=#variable-type>var()</a> function.
441-
The syntax of <a class=css data-link-type=maybe href=#variable-type>var()</a> is:
440+
which can then be substituted into another property with the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> function.
441+
The syntax of <a class=css data-link-type=maybe href=#funcdef-var>var()</a> is:
442442

443-
<pre class=prod><dfn data-dfn-type=type data-export="" id=variable-type title="<variable>|var()">&lt;variable&gt;</dfn> = var( <var>variable-name</var> [, <a class=production data-link-type=type href=#typedef-any-value>&lt;any-value&gt;</a> ]? )
443+
<pre class=prod><dfn data-dfn-type=function data-export="" id=funcdef-var>var()</dfn> = var( <a class=production data-link-type=type>&lt;ident&gt;</a> [, <a class=production data-link-type=type href=#typedef-any-value>&lt;any-value&gt;</a> ]? )
444444
</pre>
445445
<p> A variable can be used in place of any part of a value in any property on an element.
446446
Variables can not be used as
@@ -450,7 +450,8 @@ <h2 data-level=3 id=using-variables><span class=secno>3 </span><span class=conte
450450
(Doing so usually produces invalid syntax,
451451
or else a value whose meaning has no connection to the variable.)
452452

453-
<p> The second argument to the function, if provided,
453+
<p> The first argument to the function is the name of the variable to be substituted.
454+
The second argument to the function, if provided,
454455
is a fallback value,
455456
which is used as the substitution value when the referenced variable is invalid.
456457

@@ -466,18 +467,18 @@ <h2 data-level=3 id=using-variables><span class=secno>3 </span><span class=conte
466467

467468
<ol>
468469
<li>
469-
If the variable named by the first argument to the <a class=css data-link-type=maybe href=#variable-type>var()</a> function is a valid variable,
470-
replace the <a class=css data-link-type=maybe href=#variable-type>var()</a> function by the value of the corresponding <a href=#custom-property>custom property</a>.
470+
If the variable named by the first argument to the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> function is a valid variable,
471+
replace the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> function by the value of the corresponding <a href=#custom-property>custom property</a>.
471472

472473
<li>
473-
Otherwise, if the <a class=css data-link-type=maybe href=#variable-type>var()</a> function has a fallback value as its second argument,
474-
replace the <a class=css data-link-type=maybe href=#variable-type>var()</a> function by the fallback value.
475-
If there are any <a class=css data-link-type=maybe href=#variable-type>var()</a> references in the fallback,
474+
Otherwise, if the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> function has a fallback value as its second argument,
475+
replace the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> function by the fallback value.
476+
If there are any <a class=css data-link-type=maybe href=#funcdef-var>var()</a> references in the fallback,
476477
<a href=#resolve-a-variable title="resolve a variable">resolve</a> them as well.
477478

478479
<li>
479480
Otherwise,
480-
the property containing the <a class=css data-link-type=maybe href=#variable-type>var()</a> function is <a href=#invalid-at-computed-value-time>invalid at computed-value time</a>.
481+
the property containing the <a class=css data-link-type=maybe href=#funcdef-var>var()</a> function is <a href=#invalid-at-computed-value-time>invalid at computed-value time</a>.
481482

482483
<p class=note> Note: Other things can also make a property <a href=#invalid-at-computed-value-time>invalid at computed-value time</a>.
483484
</ol>
@@ -964,9 +965,8 @@ <h2 class="no-num no-ref" id=index><span class=content>
964965
<li>invalid at computed-value time, <a href=#invalid-at-computed-value-time title="section 3.1">3.1</a>
965966
<li>invalid variable, <a href=#invalid-variable title="section 3.1">3.1</a>
966967
<li>resolve a variable, <a href=#resolve-a-variable title="section 3">3</a>
967-
<li>var(), <a href=#variable-type title="section 3">3</a>
968+
<li>var(), <a href=#funcdef-var title="section 3">3</a>
968969
<li>variable, <a href=#cascading-variable title="section 2.2">2.2</a>
969-
<li>&lt;variable&gt;, <a href=#variable-type title="section 3">3</a>
970970
</ul></div>
971971

972972
<h2 class="no-num no-ref" id=property-index><span class=content>

css-variables/Overview.src.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h1>CSS Custom Properties for Cascading Variables Module Level 1</h1>
1010
Previous Version: http://www.w3.org/TR/2012/WD-css-variables-20120410/
1111
Editor: Tab Atkins Jr., Google, http://xanthir.com/contact
1212
Abstract: This module introduces cascading variables as a new primitive value type that is accepted by all CSS properties, and custom properties for defining them.
13-
Ignored Terms: var-0, var-foo, var-main-color, var-Bar, var-two, var-header-color, var-accent-background, var-foo-bar, var-bar, var-one
13+
Ignored Terms: var-0, var-foo, var-main-color, var-Bar, var-two, var-header-color, var-accent-background, var-foo-bar, var-bar, var-one, <ident>
1414
</pre>
1515

1616
<h2>
@@ -386,7 +386,7 @@ <h2 id='using-variables'>
386386
The syntax of ''var()'' is:
387387

388388
<pre class='prod'>
389-
<dfn id='variable-type' title="<variable>|var()">&lt;variable></dfn> = var( <var>variable-name</var> [, <<any-value>> ]? )
389+
<dfn>var()</dfn> = var( <<ident>> [, <<any-value>> ]? )
390390
</pre>
391391

392392
A variable can be used in place of any part of a value in any property on an element.
@@ -397,6 +397,7 @@ <h2 id='using-variables'>
397397
(Doing so usually produces invalid syntax,
398398
or else a value whose meaning has no connection to the variable.)
399399

400+
The first argument to the function is the name of the variable to be substituted.
400401
The second argument to the function, if provided,
401402
is a fallback value,
402403
which is used as the substitution value when the referenced variable is invalid.

0 commit comments

Comments
 (0)