Skip to content

Commit 46ffab2

Browse files
committed
[css-variables] Disallow top-level '\!' characters as well.
1 parent 8f4a781 commit 46ffab2

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

css-variables/Overview.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
225225
<p> The allowed syntax for <a data-autolink="link" href="#custom-property">custom properties</a> is extremely permissive.
226226
The <dfn id="any-value-production">&lt;any-value&gt;</dfn> production matches <em>any</em> sequence of one or more tokens,
227227
so long as the sequence does not contain
228-
<a data-autolink="link" class="production"><var>&lt;bad-string&gt;</var></a>,
229-
<a data-autolink="link" class="production"><var>&lt;bad-url&gt;</var></a>,
228+
<a data-autolink="link" class="production"><var>&lt;bad-string&gt;</var></a>,
229+
<a data-autolink="link" class="production"><var>&lt;bad-url&gt;</var></a>,
230230
unmatched &lt;&lt;)&gt;&gt;, &lt;&lt;]&gt;&gt;, or &lt;&lt;}&gt;&gt;,
231-
or top-level <a data-autolink="link" class="production"><var>&lt;semicolon&gt;</var></a> tokens.
231+
or top-level <a data-autolink="link" class="production"><var>&lt;semicolon&gt;</var></a> tokens or <a data-autolink="link" class="production"><var>&lt;delim&gt;</var></a> tokens with a value of "!".
232232

233233
</p><p class="note"> Note: This definition,
234234
along with the general CSS syntax rules,
@@ -240,6 +240,9 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
240240
</p><p class="note"> Note: Custom properties can contain a trailing <span data-autolink="maybe" class="css">!important</span>,
241241
but this is automatically removed from the property's value by the CSS parser,
242242
and makes the custom property "important" in the CSS cascade.
243+
In other words, the prohibition on top-level "!" characters
244+
does not prevent <span data-autolink="maybe" class="css">!important</span> from being used,
245+
as the <span data-autolink="maybe" class="css">!important</span> is removed before syntax checking happens.
243246

244247
</p><p class="note"> Note: While <a data-autolink="link" class="production" href="#any-value-production"><var>&lt;any-value&gt;</var></a> must represent at least one token,
245248
that one token may be whitespace.
@@ -937,7 +940,7 @@ <h3 class="no-ref" id="testing">
937940

938941
<h3 id="normative" class="no-num no-ref">
939942
Normative References</h3>
940-
<div data-fill-with="normative-references"><dl><dt id="rfc2119" title="RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt">Key words for use in RFCs to Indicate Requirement Levels</a>. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a></dd><dt id="css21" title="CSS21">[CSS21]</dt><dd>Bert Bos; et al. <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">http://www.w3.org/TR/2011/REC-CSS2-20110607/</a></dd></dl></div>
943+
<div data-fill-with="normative-references"><dl><dt id="css21" title="CSS21">[CSS21]</dt><dd>Bert Bos; et al. <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/">http://www.w3.org/TR/2011/REC-CSS2-20110607/</a></dd><dt id="rfc2119" title="RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt">Key words for use in RFCs to Indicate Requirement Levels</a>. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a></dd></dl></div>
941944

942945
<h3 id="informative" class="no-num no-ref">
943946
Informative References</h3>

css-variables/Overview.src.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ <h2 id='defining-variables'>
155155
The allowed syntax for <a>custom properties</a> is extremely permissive.
156156
The <dfn>&lt;any-value></dfn> production matches <em>any</em> sequence of one or more tokens,
157157
so long as the sequence does not contain
158-
<<bad-string>>,
159-
<<bad-url>>,
158+
<<bad-string>>,
159+
<<bad-url>>,
160160
unmatched <<)>>, <<]>>, or <<}>>,
161-
or top-level <<semicolon>> tokens.
161+
or top-level <<semicolon>> tokens or <<delim>> tokens with a value of "!".
162162

163163
Note: This definition,
164164
along with the general CSS syntax rules,
@@ -170,6 +170,9 @@ <h2 id='defining-variables'>
170170
Note: Custom properties can contain a trailing ''!important'',
171171
but this is automatically removed from the property's value by the CSS parser,
172172
and makes the custom property "important" in the CSS cascade.
173+
In other words, the prohibition on top-level "!" characters
174+
does not prevent ''!important'' from being used,
175+
as the ''!important'' is removed before syntax checking happens.
173176

174177
Note: While <<any-value>> must represent at least one token,
175178
that one token may be whitespace.

0 commit comments

Comments
 (0)