Open cdoublev opened 1 year ago
To clarify my point...
Returning null
instead of empty string from CSSPropertyRule.initialValue
when the descriptor is omitted, seems inappropriate, because its actual value is the guaranteed-invalid value, which is represented (serialized) with an empty string.
To add some arguments...
Similarly, style.getPropertyValue('any-undeclared-property')
returns an empty string, and when any @counter-style
descriptor is omitted, the corresponding attribute returns empty string. (Their actual value is not the guaranteed-invalid value though).
To give an explicit suggestion:
- readonly attribute CSSOMString? initialValue;
+ readonly attribute CSSOMString initialValue;
- - initialValue, of type CSSOMString, readonly, nullable
- The initial value associated with the @property rule, which may not be present.
+
+ - initialValue, of type CSSOMString, readonly
+ The initial value associated with the @property,
+ or empty string when the descriptor was not specified in the associated rule.
The spec says it is nullable / it may not be present:
https://drafts.css-houdini.org/css-properties-values-api-1/#dom-csspropertyrule-initialvalue
But also:
https://drafts.css-houdini.org/css-properties-values-api-1/#initial-value-descriptor
So when the descriptor declaration is omitted, it seems the attribute should serialize the guaranteed-invalid value, which serializes to empty string.
In Chrome: