Skip to content

Commit

Permalink
Stop pre-parsing declarations on {} blocks only when nested allowed
Browse files Browse the repository at this point in the history
When nesting is not allowed, we should consume tokens until we meet a
semicolon. When it’s allowed, we have to stop at {} blocks to keep possibly
valid declarations after them.
  • Loading branch information
liZe committed Jan 21, 2024
1 parent b2e9861 commit 305cac7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tinycss2/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _consume_declaration_in_list(first_token, tokens, allow_nested):
semicolon_token.append(token)
break
declaration_tokens.append(token)
if token.type == '{} block':
if allow_nested and token.type == '{} block':
break
declaration = _parse_declaration(first_token, iter(declaration_tokens))
if not allow_nested or declaration.type == 'declaration':
Expand Down

0 comments on commit 305cac7

Please sign in to comment.