From 7c84ae55dacee7368c9ac7025b8c470c488dcf8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 7 Oct 2026 21:00:43 +0200 Subject: [PATCH] parser: Don't ignore a closing curly bracket from within the declaration parser. Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=2065482. This gets the behavior that matches other browsers and is a one-liner. If you're in a block, `}` is the delimiter anyway (so the iterator can't see it). Otherwise, if you're not parsing qualified rules, you go to the skip-until-semicolon path. The spec is a bit broken here, see https://github.com/w3c/csswg-drafts/issues/14565. Tests and review in https://phabricator.services.mozilla.com/D331713 --- src/rules_and_declarations.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rules_and_declarations.rs b/src/rules_and_declarations.rs index 0a72b850..8a39a54b 100644 --- a/src/rules_and_declarations.rs +++ b/src/rules_and_declarations.rs @@ -262,10 +262,7 @@ where self.input.skip_whitespace(); let start = self.input.state(); match self.input.next_including_whitespace_and_comments().ok()? { - Token::CloseCurlyBracket - | Token::WhiteSpace(..) - | Token::Semicolon - | Token::Comment(..) => continue, + Token::WhiteSpace(..) | Token::Semicolon | Token::Comment(..) => continue, Token::AtKeyword(name) => { let name = name.clone(); return Some(parse_at_rule(&start, name, self.input, &mut *self.parser));