Skip to content

Commit 57fc936

Browse files
committed
Define precisely where the property registration is stored. Fixes w3c#216.
1 parent 0de6a0d commit 57fc936

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

css-properties-values-api/Overview.bs

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ Repository: w3c/css-houdini-drafts
3838
spec:css-transforms-1; type:type; text:<transform-function>
3939
spec:cssom-1; type:interface; text:CSS
4040
spec:css-color-4; type:property; text:color
41-
spec:dom; type:dfn; text:ascii case-insensitive
41+
spec:dom;
42+
type:dfn; text:ascii case-insensitive
43+
type:interface; text:Document
4244
</pre>
4345

4446
Introduction {#intro}
@@ -76,7 +78,7 @@ partial interface CSS {
7678
};
7779
</pre>
7880

79-
Additional, the {{Window}} object gains a new <dfn attribute for=Window>\[[registeredPropertySet]]</dfn> private slot,
81+
Additional, the {{Document}} object gains a new <dfn attribute for=Window>\[[registeredPropertySet]]</dfn> private slot,
8082
which is a set of records that describe registered custom properties.
8183

8284
The {{PropertyDescriptor}} dictionary {#the-propertydescriptor-dictionary}
@@ -118,7 +120,13 @@ as arguments of the same names.
118120
and |initialValue| being a string,
119121
execute these steps:
120122

121-
1. Attempt to parse |name|
123+
1. Let |property set|
124+
be the value of the
125+
<a>current global object's</a>
126+
<a>associated <code>Document</code></a>'s
127+
{{[[registeredPropertySet]]}} slot.
128+
129+
2. Attempt to parse |name|
122130
as a <<custom-property-name>>.
123131
If this fails,
124132
<a>throw</a> a {{SyntaxError}}
@@ -127,13 +135,13 @@ as arguments of the same names.
127135
Otherwise,
128136
let |parsed name| be the parsed value.
129137

130-
If the window's {{[[registeredPropertySet]]}} slot
138+
If |property set|
131139
already contains an entry with |parsed name| as its property name
132140
(compared codepoint-wise),
133141
<a>throw</a> an {{InvalidModificationError}}
134142
and exit this algorithm.
135143

136-
2. If |syntax| is not present,
144+
3. If |syntax| is not present,
137145
or is equal to <code>"*"</code> (U+002A ASTERISK),
138146
let |parsed syntax| be undefined,
139147
and skip to the next step of this algorithm.
@@ -151,7 +159,7 @@ as arguments of the same names.
151159
Future levels of this specification are expected to expand the complexity of allowed syntax strings,
152160
allowing custom properties that more closely resemble the full breadth of what CSS properties allow.
153161

154-
3. If |parsed syntax| is undefined,
162+
4. If |parsed syntax| is undefined,
155163
and |initialValue| is not present,
156164
let |parsed initial value| be empty.
157165
This must be treated identically to the "default" initial value of custom properties,
@@ -184,17 +192,17 @@ as arguments of the same names.
184192
<a>throw</a> a {{SyntaxError}}
185193
and exit this algorithm.
186194

187-
4. If |inherits| is present,
195+
5. If |inherits| is present,
188196
set |inherit flag| to its value.
189197
Otherwise, set |inherit flag| to false.
190198

191-
5. Let |registered property| be a record
199+
6. Let |registered property| be a record
192200
with a property name of |parsed name|,
193201
a syntax of |parsed syntax|,
194202
an initial value of |parsed initial value|,
195203
and an inherit flag of |inherit flag|.
196204
Add |registered property|
197-
to the window's {{[[registeredPropertySet]]}}.
205+
to |property set|.
198206
</div>
199207

200208
A property value is <dfn export>computationally idempotent</dfn>
@@ -231,16 +239,22 @@ with a <code>name</code> set to its sole argument.
231239
<div algorithm>
232240
To <dfn>unregister a custom property</dfn> with the name |name|:
233241

234-
1. If the window's {{[[registeredPropertySet]]}}
242+
1. Let |property set|
243+
be the value of the
244+
<a>current global object's</a>
245+
<a>associated <code>Document</code></a>'s
246+
{{[[registeredPropertySet]]}} slot.
247+
248+
2. If |property set|
235249
contains a record with a property name matching |name|
236250
(compared codepoint-wise),
237-
remove the record from the set.
251+
remove the record from |property set|.
238252

239253
Otherwise,
240254
<a>throw</a> a {{NotFoundError}}.
241255
</div>
242256

243-
When the window's {{[[registeredPropertySet]]}} changes,
257+
When the <a>current global object's</a> <a>associated <code>Document</code></a>'s {{[[registeredPropertySet]]}} changes,
244258
previously syntactically invalid property values can become valid and vice versa.
245259
This can change the set of <a>declared values</a> which requires the <a>cascade</a> to be recomputed.
246260

0 commit comments

Comments
 (0)