css-houdini-drafts
css-houdini-drafts copied to clipboard
[css-properties-values-api] `initial-value` for `*` with arbitrary substitution values
If I understand the spec correctly, initial-value does not require to be validated when syntax is *.
But in Chrome, given the CSS rules below:
- the first rule is valid:
initial-value: var(1)is discarded - the second rule is invalid
@property --p1 {
inherits: false;
syntax: "*";
initial-value: green;
initial-value: var(1);
}
@property --p2 {
inherits: false;
syntax: "*";
initial-value: green;
initial-value: var(--initial);
}
I am completely confused by the parse result in Chrome. Anyway, should initial-value be invalid when it includes an arbitrary substitution value?
Hm, the spec is indeed unclear here. I prefer Chrome's behavior - validating the initial-value as normal for an untyped custom property. The spec just needs its conditions to be slightly rephrased to match.
To clarify my understanding:
- in the first rule,
initial-value: var(1)makes the descriptor invalid and ignored - in the second rule,
initial-value: var(--initial)makes the rule invalid because it is computationally dependent
That is, var(1) is invalid at the syntax level of initial-value, as specified:
If a property contains one or more
var()functions, and those functions are syntactically valid, the entire property’s grammar must be assumed to be valid at parse time.
And initial-value: var(--initial) is invalid at the context level of @property, as specified:
- The
initial-valuemust be computationally independent.If the above conditions are not met, the
@propertyrule is invalid.
Computationally dependent values could have been specified as invalid at the context level of initial-value, but this does not seem important since authors will probably not make multiple declarations of initial-value.
So the specifications are already clear and I am closing this issue. I hope I am not missing something.
Indeed, I missed something. initial-value must be computationally independent only when syntax is *.