Skip to content

Commit

Permalink
Stop pre-parsing declarations after {} blocks
Browse files Browse the repository at this point in the history
We don’t want to consume tokens after curly brackets as they may be a
declaration we want to keep in the tokens iterator.
  • Loading branch information
liZe committed Jan 21, 2024
1 parent 8b296a8 commit b2e9861
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tinycss2/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def _consume_declaration_in_list(first_token, tokens, allow_nested):
semicolon_token.append(token)
break
declaration_tokens.append(token)
if token.type == '{} block':
break
declaration = _parse_declaration(first_token, iter(declaration_tokens))
if not allow_nested or declaration.type == 'declaration':
return declaration
Expand Down

0 comments on commit b2e9861

Please sign in to comment.