Skip to content

Commit 123451e

Browse files
committed
Fix parsing nested forgiving grammars
`:is(:not(:is(:unknown()), valid))` was parsed as `:is()` containing an invalid selector (but serializing as is), because the parse error resulting from `:unknown()` was propagated above `:not()`, since the top-level `:is()` is forgiving. This was a wrong optimization.
1 parent aaf24dc commit 123451e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/parse/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ function parseCSSValue(input, definition, context, strategy = 'backtrack') {
11061106
switch (root.state) {
11071107
// The top-level list is guaranteed to be invalid (match is SyntaxError)
11081108
case 'aborted':
1109-
return (forgiving && !context.function?.context.forgiving) ? null : match
1109+
return forgiving ? null : match
11101110
// The current list is invalid (match is null or undefined)
11111111
case 'rejected':
11121112
return type === 'declaration' ? parseCSSValueSubstitution(input, context) : null

0 commit comments

Comments
 (0)