Skip to content

Commit 3360ce5

Browse files
committed
Added note further explaining the variable model, per feedback from dbaron.
1 parent 203964c commit 3360ce5

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

css-variables/Overview.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,20 @@ <h2 id=using-variables><span class=secno>3. </span> Using Variables</h2>
372372
href="#invalid-at-computed-value-time"><i>invalid at computed-value
373373
time</i></a>.
374374

375+
<div class=note>
376+
<p>I'm not sure how to precisely define where/how variables can be used.
377+
The Grammar section has a perfect definition, it weren't all
378+
non-normative (because it's just extending the 2.1 grammar). I don't know
379+
if 2.1 actually has a term for what is represented by the "term"
380+
production in the 2.1 grammar.</p>
381+
382+
<p>Basically, though, variables are lexically substituted into the
383+
property value, with restrictions on where they can appear as implied by
384+
the Grammar section. You can't, for example, do something ridiculous like
385+
&lsquo;<code class=css>@var $unit px; div { width: 20$unit;
386+
}</code>&rsquo;.</p>
387+
</div>
388+
375389
<div class=example>
376390
<p>For example, the following usage is fine from a syntax standpoint, but
377391
results in nonsense when the variable is substituted in:</p>

css-variables/Overview.src.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,13 @@ <h2 id='using-variables'>
141141

142142
<p>A variable is substituted for its value in the property value at computed-value time. If a declaration, once all variables are substituted in, is invalid, the declaration is <i>invalid at computed-value time</i>.</p>
143143

144-
<div class='example'>
144+
<div class='note'>
145+
<p>I'm not sure how to precisely define where/how variables can be used. The Grammar section has a perfect definition, it weren't all non-normative (because it's just extending the 2.1 grammar). I don't know if 2.1 actually has a term for what is represented by the "term" production in the 2.1 grammar.</p>
146+
147+
<p>Basically, though, variables are lexically substituted into the property value, with restrictions on where they can appear as implied by the Grammar section. You can't, for example, do something ridiculous like ''@var $unit px; div { width: 20$unit; }''.</p>
148+
</div>
149+
150+
<div class='example'>
145151
<p>For example, the following usage is fine from a syntax standpoint, but results in nonsense when the variable is substituted in:</p>
146152

147153
<pre>

0 commit comments

Comments
 (0)