Skip to content

Commit 1dcc682

Browse files
committed
[css-variables] Relax the <ident> requirement on custom property suffixes.
1 parent c416318 commit 1dcc682

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

css-variables/Overview.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</a></p>
1414
<h1 class="p-name no-ref" id="title">CSS Custom Properties for Cascading Variables Module Level 1</h1>
1515
<h2 class="no-num no-toc no-ref" id="subtitle">Editor's Draft,
16-
<span class="dt-updated"><span class="value-title" title="20130330">30 March 2013</span></span></h2>
16+
<span class="dt-updated"><span class="value-title" title="20130401">1 April 2013</span></span></h2>
1717
<div data-fill-with="spec-metadata"><dl><dt>This version:</dt><dd><a href="http://dev.w3.org/csswg/css-variables/" class="u-url">http://dev.w3.org/csswg/css-variables/</a></dd><dt>Latest version:</dt><dd><a href="http://www.w3.org/TR/css-variables/">http://www.w3.org/TR/css-variables/</a></dd><dt>Editor's Draft:</dt><dd><a href="http://dev.w3.org/csswg/css-variables/">http://dev.w3.org/csswg/css-variables/</a></dd><dt>Previous Versions:</dt><dd><a href="http://www.w3.org/TR/2013/WD-css-variables-20130312/" rel="previous">http://www.w3.org/TR/2013/WD-css-variables-20130312/</a></dd><dd><a href="http://www.w3.org/TR/2012/WD-css-variables-20120410/" rel="previous">http://www.w3.org/TR/2012/WD-css-variables-20120410/</a>
1818
</dd><dt>Feedback:</dt>
1919
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-variables%5D%20feedback">www-style@w3.org</a>
@@ -150,6 +150,7 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
150150
</p><table class="propdef"><tbody><tr><th>Name:</th><td><dfn id="var-">var-*</dfn></td></tr><tr><th>Values:</th><td>[ <a data-autolink="link" class="production" href="#value-production"><var>&lt;value&gt;</var></a> | <a data-autolink="link" class="production" href="#cdo-production"><var>&lt;CDO&gt;</var></a> | <a data-autolink="link" class="production" href="#cdc-production"><var>&lt;CDC&gt;</var></a> ]</td></tr><tr><th>Initial:</th><td>(nothing, see prose)</td></tr><tr><th>Applies To:</th><td>all elements</td></tr><tr><th>Inherited:</th><td>yes</td></tr><tr><th>Computed Value:</th><td>specified value with variables substituted (but see prose for "invalid variables")</td></tr><tr><th>Media:</th><td>all</td></tr></tbody></table>
151151
<p> A <dfn id="custom-property">custom property</dfn> is any property
152152
whose name starts with "var-",
153+
and contains at least one additional character.
153154
and the rest of the name conforms to the grammar for an identifier <a data-autolink="biblio" U00022="" data-biblio-type="normative" title="CSS3VAL" href="#css3val">[CSS3VAL]</a>.
154155
<a data-autolink="link" href="#custom-property">Custom properties</a> are solely for use by authors and users;
155156
CSS will never give them a meaning beyond what is presented here.
@@ -180,11 +181,12 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
180181
</p></div>
181182

182183
<div class="example">
183-
The part of the custom property name after the "var-"
184-
must be an identifier by itself.
185-
This means that, for example,
186-
<a data-autolink="maybe" class="css">var-0</a> is not a valid custom property name,
184+
Authors are recommended to choose custom property names
185+
so that the part after the "var-" is an identifier by itself,
186+
so that it can be referenced without <a href="http://www.w3.org/TR/CSS21/syndata.html#escaped-characters">character escaping</a>.
187+
For example, <a data-autolink="property" class="property" title="var-0">var-0</a> needs to be referenced as <a data-autolink="maybe" class="css">var(\30)</a>,
187188
because <a data-autolink="maybe" class="css">0</a> isn't a valid identifier.
189+
(U+0030 is the hexadecimal code for the <a data-autolink="maybe" class="css">0</a> character.)
188190
</div>
189191

190192
<p> Unlike other CSS properties,
@@ -686,7 +688,7 @@ <h3 id="the-cssstyledeclaration-interface" data-level="4.1"><span class="secno">
686688
</td></tr><tr>
687689
<td><code>el.style.var.Bar</code>
688690
</td><td><code>"red"</code>
689-
</td><td>The value of 'var-Bar'.
691+
</td><td>The value of <a data-autolink="property" class="property" title="var-Bar">var-Bar</a>.
690692
</td></tr><tr>
691693
<td><code>el.style.var["foo-bar"]</code>
692694
</td><td><code>"50%"</code>
@@ -705,7 +707,7 @@ <h3 id="the-cssstyledeclaration-interface" data-level="4.1"><span class="secno">
705707
</td><td>Retrieves the value of <a data-autolink="property" class="property" title="var-foo">var-foo</a>
706708
(the string <code>"16px"</code>)
707709
and subtracts some unrelated JavaScript variable named "bar" from it,
708-
rather than just retrieving the value of 'var-foo-bar'.
710+
rather than just retrieving the value of <a data-autolink="property" class="property" title="var-foo-bar">var-foo-bar</a>.
709711
</td></tr></tbody></table>
710712
<style scoped="">
711713
#var-code-examples td { padding: 2px; }

css-variables/Overview.src.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ <h2 id='defining-variables'>
7575

7676
A <dfn>custom property</dfn> is any property
7777
whose name starts with "var-",
78+
and contains at least one additional character.
7879
and the rest of the name conforms to the grammar for an identifier [[!CSS3VAL]].
7980
<a>Custom properties</a> are solely for use by authors and users;
8081
CSS will never give them a meaning beyond what is presented here.
@@ -107,11 +108,12 @@ <h2 id='defining-variables'>
107108
</div>
108109

109110
<div class='example'>
110-
The part of the custom property name after the "var-"
111-
must be an identifier by itself.
112-
This means that, for example,
113-
''var-0'' is not a valid custom property name,
111+
Authors are recommended to choose custom property names
112+
so that the part after the "var-" is an identifier by itself,
113+
so that it can be referenced without <a href="http://www.w3.org/TR/CSS21/syndata.html#escaped-characters">character escaping</a>.
114+
For example, 'var-0' needs to be referenced as ''var(\30)'',
114115
because ''0'' isn't a valid identifier.
116+
(U+0030 is the hexadecimal code for the ''0'' character.)
115117
</div>
116118

117119
Unlike other CSS properties,

0 commit comments

Comments
 (0)