allow escapes at the start of selectors

This commit is contained in:
ConnorSkees 2020-05-16 16:15:11 -04:00
parent 374e9f9eb4
commit eea8bdbc25
2 changed files with 6 additions and 1 deletions

View File

@ -157,7 +157,7 @@ impl<'a> StyleSheetParser<'a> {
while let Some(Token { kind, .. }) = self.lexer.peek() {
match kind {
'a'..='z' | 'A'..='Z' | '_' | '-' | '0'..='9'
| '[' | '#' | ':' | '*' | '%' | '.' | '>' => rules
| '[' | '#' | ':' | '*' | '%' | '.' | '>' | '\\' => rules
.extend(self.eat_rules(&Selector::new(), &mut Scope::new())?),
&'\t' | &'\n' | ' ' => {
self.lexer.next();

View File

@ -507,3 +507,8 @@ test!(
"a, %b {\n color: nth(&, 2);\n}\n",
"a {\n color: %b;\n}\n"
);
test!(
escape_at_start_of_selector,
"\\61 {\n color: red;\n}\n",
"a {\n color: red;\n}\n"
);