@@ -3139,6 +3139,37 @@ Defining Block Contents: the <<declaration-list>>, <<rule-list>>, and <<styleshe
31393139 which causes them to be dropped from the outer rule's value if they appear.
31403140 </div>
31413141
3142+ <h3 id="any-value">
3143+ Defining Arbitrary Contents: the <<declaration-value>> and <<any-value>> productions</h3>
3144+
3145+ In some grammars,
3146+ it is useful to accept any reasonable input in the grammar,
3147+ and do more specific error-handling on the contents manually
3148+ (rather than simply invalidating the construct,
3149+ as grammar mismatches tend to do).
3150+
3151+ For example, <a>custom properties</a> allow any reasonable value,
3152+ as they can contain arbitrary pieces of other CSS properties,
3153+ or be used for things that aren't part of existing CSS at all.
3154+ For another example, the <<general-enclosed>> production in Media Queries
3155+ defines the bounds of what future syntax MQs will allow,
3156+ and uses special logic to deal with "unknown" values.
3157+
3158+ To aid in this, two additional productions are defined:
3159+
3160+ The <dfn><declaration-value></dfn> production matches <em> any</em> sequence of one or more tokens,
3161+ so long as the sequence does not contain
3162+ <<bad-string-token>> ,
3163+ <<bad-url-token>> ,
3164+ unmatched <<)-token>> , <<]-token>> , or <<}-token>> ,
3165+ or top-level <<semicolon-token>> tokens or <<delim-token>> tokens with a value of "!".
3166+ It represents the entirety of what a valid declaration can have as its value.
3167+
3168+ The <dfn><any-value></dfn> production is identical to <<declaration-value>> ,
3169+ but also allows top-level <<semicolon-token>> tokens
3170+ and <<delim-token>> tokens with a value of "!".
3171+ It represents the entirety of what valid CSS can be in any context.
3172+
31423173<!--
31433174 ██████ ██████ ██████
31443175██ ██ ██ ██ ██ ██
0 commit comments