Skip to content

Commit df5afbb

Browse files
committed
Changed back to the more permissive definition of variable syntax that's just the 'value' production, but better described.
--HG-- extra : rebase_source : 8e879b4f9117a9833cbee3eef0607b9de4f3f6f2
1 parent 58d0c27 commit df5afbb

2 files changed

Lines changed: 26 additions & 11 deletions

File tree

css-variables/Overview.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,7 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
250250
<tr>
251251
<th>Values:
252252

253-
<td><a href="#value-type"><var>&lt;value></var></a>+ [ [ ‘<code
254-
class=css>,</code>’ | ‘<code class=css>/</code>’ ] <a
255-
href="#value-type"><var>&lt;value></var></a>+ ]*
253+
<td><a href="#value-type"><var>&lt;value></var></a>+
256254

257255
<tr>
258256
<th>Initial:
@@ -282,9 +280,15 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
282280
</table>
283281

284282
<p> The <dfn id=value-type><var>&lt;value></var></dfn> type used in the
285-
syntax above is defined as:
286-
287-
<pre>[ &lt;number> | &lt;percentage> | &lt;dimension> | &lt;string> | &lt;ident> | &lt;url> | &lt;function> | &lt;hash> ]</pre>
283+
syntax above is defined as anything matching the "value" production in <a
284+
href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS 2.1 Chapter
285+
4.1</a> <a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>.
286+
This puts almost no restrictions on what kinds of values you can store in
287+
variables. Obviously, any valid property value or component of a property
288+
is allowed. Additionally, this allows things that aren't yet valid CSS,
289+
like unknown keywords or functions, blocks, at-rules, and other kinds of
290+
custom micro-syntaxes like what's allowed in calc(). There <em>are</em>
291+
still rules, however; for example, unbalanced parentheses are invalid.
288292

289293
<p><em>Any</em> property name starting with the prefix "var-" is a <a
290294
href="#variable-property"><i>variable property</i></a>. Variable
@@ -956,7 +960,7 @@ <h2 class=no-num id=property-index>Property index</h2>
956960
<tr>
957961
<th><span class=property>var-*</span>
958962

959-
<td>&lt;value>+ [ [ ‘,’ | ‘/’ ] &lt;value>+ ]*
963+
<td>&lt;value>+
960964

961965
<td>invalid (a keyword, but see prose)
962966

css-variables/Overview.src.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ <h2 id="defining-variables">
9999
<td><dfn id='variable-property' title='variable property|variable properties'>var-*</dfn>
100100
<tr>
101101
<th>Values:
102-
<td><var>&lt;value></var>+ [ [ ',' | '/' ] <var>&lt;value></var>+ ]*
102+
<td><var>&lt;value></var>+
103103
<tr>
104104
<th>Initial:
105105
<td>invalid (a keyword, but see prose)
@@ -118,9 +118,20 @@ <h2 id="defining-variables">
118118
</table>
119119

120120
<p>
121-
The <dfn id='value-type'><var>&lt;value></var></dfn> type used in the syntax above is defined as:
122-
123-
<pre>[ &lt;number> | &lt;percentage> | &lt;dimension> | &lt;string> | &lt;ident> | &lt;url> | &lt;function> | &lt;hash> ]</pre>
121+
The <dfn id='value-type'><var>&lt;value></var></dfn> type used in the syntax above is defined as
122+
anything matching the "value" production in <a href="http://www.w3.org/TR/CSS2/syndata.html#tokenization">CSS 2.1 Chapter 4.1</a> [[!CSS21]].
123+
This puts almost no restrictions on what kinds of values you can store in variables.
124+
Obviously, any valid property value
125+
or component of a property
126+
is allowed.
127+
Additionally, this allows things that aren't yet valid CSS,
128+
like unknown keywords or functions,
129+
blocks,
130+
at-rules,
131+
and other kinds of custom micro-syntaxes like what's allowed in calc().
132+
There <em>are</em> still rules, however;
133+
for example,
134+
unbalanced parentheses are invalid.
124135

125136
<p><em>Any</em> property name starting with the prefix "var-" is a <i>variable property</i>. Variable properties are defined to be valid but meaningless as they are meant solely for allowing authors to pass custom data around their page, similar to the <a href="http://www.w3.org/TR/html5/global-attributes.html#embedding-custom-non-visible-data-with-the-data-attributes">custom data attributes</a> in HTML. Other specifications and user agents must not assign a particular meaning to <i>variable properties</i> or attach a specific effect to them beyond the bare minimum that comes from them being valid properties.</p>
126137

0 commit comments

Comments
 (0)