Skip to content

Commit 0f88beb

Browse files
committed
Register custom property definition from parsed @Property
1 parent 589f3dd commit 0f88beb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/parse/postprocess.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,18 +1309,27 @@ function postParsePath(path, node) {
13091309
* - it is missing a declaration for `inherits` or `syntax`
13101310
* - it is missing a declaration for `initial-value` if `syntax` is universal
13111311
* - its declaration for `initial-value` is invalid according to `syntax`
1312+
*
1313+
* It appends the property definition in the current global object’s associated
1314+
* Document's [[registeredPropertySet]] slot.
13121315
*/
13131316
function postParseProperty(rule, node) {
1314-
const { inherits, initialValue, syntax } = rule
1317+
const { name, inherits, initialValue, syntax } = rule
1318+
const register = globalThis.document._registeredPropertySet
13151319
if (inherits === undefined || syntax === undefined) {
13161320
return error(node)
13171321
}
13181322
if (syntax === '"*"') {
1319-
return cssWideKeywords.includes(initialValue) ? error(node) : rule
1323+
if (cssWideKeywords.includes(initialValue)) {
1324+
return error(node)
1325+
}
1326+
register.push({ inherits, initialValue, name, syntax })
1327+
return rule
13201328
}
13211329
if (initialValue) {
13221330
const match = parseGrammar(initialValue, syntax.slice(1, -1), '@style')
13231331
if (!isFailure(match) && isComputationallyIndependent(match)) {
1332+
register.push({ inherits, initialValue, name, syntax })
13241333
return rule
13251334
}
13261335
}

0 commit comments

Comments
 (0)