-
Notifications
You must be signed in to change notification settings - Fork 757
Description
This is a similar question than for #8795.
<declaration-value> represents any value that can be reasonably considered to look like a valid standard property. It excludes an omitted value for a custom property or @property/initial-value.
So now that consume a declaration (a syntax algorithm) should return nothing for a positioned {}-block, should <declaration-value> exclude that too? No, because a positioned {}-block is valid in a custom property value.
In my opinion, <declaration-value> (and <any-value>) should match zero or more tokens excluding <}-token>, <semicolon-token>, <delim-token> with a value of !.
From an author's perspective, it can be confusing that background-image: var(--url, invalid) is valid but not background-image: var(--url, url(bad token)), similarly as with --left: rgb( and --right: 0, 0, 0). Ok, using custom properties outside of CSS is not their primary use. But none of these declarations looks invalid.
Now it is probably too late to allow bad tokens, <)-token>, <]-token>, but maybe not zero token.
Most of the time, <declaration-value> (and <any-value>) is explicitly made optional ?. In env(), if(), inherit(), random-item(), var(), @property/initial-value, custom properties, etc.
It is not optional as a custom function argument but --mixin(255,, 0) might be useful with @function --mixin(--r: 0, r: 127, b: 0) { ... }. It is also not optional for @function parameters, param(), first-valid(), but I do not want to argue why it could also be optional and make this comment longer than it already is.