@@ -261,7 +261,9 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Custom
261261 < tr >
262262 < th > Values:
263263
264- < td > < var > <value> </ var >
264+ < td > < a href ="#ltvalue "> < var > <value> </ var > </ a > | < a
265+ href ="#ltcdo "> < var > <CDO> </ var > </ a > | < a
266+ href ="#ltcdc "> < var > <CDC> </ var > </ a >
265267
266268 < tr >
267269 < th > Initial:
@@ -313,20 +315,32 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Custom
313315 </ div >
314316
315317 < p > < a href ="#custom-property "> < i > Custom properties</ i > </ a > have an
316- extremely permissive value grammar, defined as the "value" production in
317- < a href ="http://www.w3.org/TR/CSS2/syndata.html#tokenization "> CSS 2.1
318- Chapter 4.1</ a > < a href ="#CSS21 "
319- rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a > . This implies that any valid
320- CSS value can be used, but it's much wider than that. Roughly, anything
321- can be used except for unclosed quotes, parens, braces, or square
322- brackets, or any character that would normally end a declaration (a
323- top-level semicolon or close brace).
318+ extremely permissive value grammar. The < dfn id =ltvalue > <value> </ dfn >
319+ in its grammar corresponds to the "value" production in < a
320+ href ="http://www.w3.org/TR/CSS2/syndata.html#tokenization "> CSS 2.1 Chapter
321+ 4.1</ a > < a href ="#CSS21 " rel =biblioentry > [CSS21]<!--{{!CSS21}}--> </ a > ,
322+ while < dfn id =ltcdo > <CDO> </ dfn > and < dfn id =ltcdc > <CDC> </ dfn >
323+ correspond to the tokens of the same name from the same chapter (they
324+ represent HTML comments showing up in CSS text - "<!--" and "-->").
325+ This is a very technical way of saying that nearly anything can be used in
326+ the value of a custom property, save unmatched closing brackets ("]", ")",
327+ or "}"), a top-level semicolon (as it will end the property), a
328+ "!important" that's not at the end, or invalid tokens (such as BAD_STRING
329+ and BAD_URL).
324330
325331 < p class =note > Note: Custom properties can contain a trailing ‘< code
326332 class =css > !important</ code > ’, but this is automatically removed from the
327333 property's value by the CSS parser, and makes the custom property
328334 "important" in the CSS cascade.
329335
336+ < div class =example > For example, the following is a valid custom property:
337+ < pre > var-foo: if(x > 5) this.width = 10;</ pre >
338+
339+ < p > While this value is obviously useless as a < a
340+ href ="#cascading-variable "> < em > variable</ em > </ a > , as it would be invalid
341+ in any normal property, it might be read and acted on by JavaScript.
342+ </ div >
343+
330344 < p > There are an infinity of < a href ="#custom-property "> < i > custom
331345 properties</ i > </ a > , but the initial value of a < a
332346 href ="#custom-property "> < i > custom property</ i > </ a > is an empty invalid
@@ -1029,6 +1043,10 @@ <h2 class=no-num id=index>Index</h2>
10291043 < li > cascading variable, < a href ="#cascading-variable "
10301044 title ="section 2. "> < strong > 2.</ strong > </ a >
10311045
1046+ < li > <CDC> , < a href ="#ltcdc " title ="section 2. "> < strong > 2.</ strong > </ a >
1047+
1048+ < li > <CDO> , < a href ="#ltcdo " title ="section 2. "> < strong > 2.</ strong > </ a >
1049+
10321050 < li > creator, < a href ="#cssvariablesdeclaration-creator "
10331051 title ="section 4.2. "> < strong > 4.2.</ strong > </ a >
10341052
@@ -1072,6 +1090,9 @@ <h2 class=no-num id=index>Index</h2>
10721090 title ="section 5.2. "> < strong > 5.2.</ strong > </ a >
10731091 </ ul >
10741092
1093+ < li > <value> , < a href ="#ltvalue "
1094+ title ="section 2. "> < strong > 2.</ strong > </ a >
1095+
10751096 < li > var-*, < a href ="#var- " title ="section 2. "> < strong > 2.</ strong > </ a >
10761097
10771098 < li > variable, < a href ="#cascading-variable "
@@ -1106,7 +1127,7 @@ <h2 class=no-num id=property-index>Property index</h2>
11061127 < tr >
11071128 < th > < a class =property href ="#var- "> var-*</ a >
11081129
1109- < td > <value>
1130+ < td > <value> | <CDO > | <CDC >
11101131
11111132 < td > (nothing, see prose)
11121133
0 commit comments