@@ -17,9 +17,13 @@ class CSSPropertyRuleImpl extends CSSRuleImpl {
17
17
super ( globalObject , args , privateData )
18
18
const { prelude, value } = privateData
19
19
this . name = serializeCSSComponentValue ( prelude )
20
- value . declarations . forEach ( ( { name, value } ) =>
21
- this [ cssPropertyToIDLAttribute ( name ) ] = serializeCSSValue ( { name, value } ) )
22
- this . initialValue ??= null
20
+ value . declarations . forEach ( ( { name, value } ) => {
21
+ let attribute = cssPropertyToIDLAttribute ( name )
22
+ if ( attribute === 'initialValue' ) {
23
+ attribute = `_${ attribute } `
24
+ }
25
+ this [ attribute ] = serializeCSSValue ( { name, value } )
26
+ } )
23
27
}
24
28
25
29
/**
@@ -28,14 +32,22 @@ class CSSPropertyRuleImpl extends CSSRuleImpl {
28
32
* @see {@link https://drafts.css-houdini.org/css-properties-values-api-1/#serialize-a-csspropertyrule }
29
33
*/
30
34
get cssText ( ) {
31
- const { inherits, initialValue , name, syntax } = this
35
+ const { inherits, _initialValue , name, syntax } = this
32
36
let string = `@property ${ name } { syntax: ${ syntax } ; inherits: ${ inherits } ; `
33
- if ( initialValue !== null ) {
34
- string += `initial-value: ${ initialValue } ; `
37
+ if ( _initialValue !== undefined ) {
38
+ string += `initial-value: ${ _initialValue } ; `
35
39
}
36
40
string += '}'
37
41
return string
38
42
}
43
+
44
+ /**
45
+ * @see {@link https://drafts.css-houdini.org/css-properties-values-api-1/#dom-csspropertyrule-initialvalue }
46
+ * @see {@link https://github.com/w3c/css-houdini-drafts/issues/1115 }
47
+ */
48
+ get initialValue ( ) {
49
+ return this . _initialValue ?? ''
50
+ }
39
51
}
40
52
41
53
module . exports = {
0 commit comments