allow whitespace between ! and important

This commit is contained in:
ConnorSkees 2020-03-31 22:00:38 -04:00
parent faf9cf8818
commit 978fbaade0
4 changed files with 10 additions and 2 deletions

View File

@ -61,7 +61,8 @@ impl If {
let cond = read_until_open_curly_brace(toks); let cond = read_until_open_curly_brace(toks);
toks.next(); toks.next();
devour_whitespace(toks); devour_whitespace(toks);
branches.push(Branch::new(cond, read_until_closing_curly_brace(toks))); branches
.push(Branch::new(cond, read_until_closing_curly_brace(toks)));
toks.next(); toks.next();
devour_whitespace(toks); devour_whitespace(toks);
} }

View File

@ -211,6 +211,7 @@ impl Value {
} }
'!' => { '!' => {
toks.next(); toks.next();
devour_whitespace(toks);
if toks.peek().unwrap().kind == '=' { if toks.peek().unwrap().kind == '=' {
toks.next(); toks.next();
devour_whitespace(toks); devour_whitespace(toks);
@ -545,6 +546,7 @@ impl Value {
} }
'!' => { '!' => {
toks.next(); toks.next();
devour_whitespace(toks);
let v = eat_ident(toks, scope, super_selector)?; let v = eat_ident(toks, scope, super_selector)?;
if v.to_ascii_lowercase().as_str() == "important" { if v.to_ascii_lowercase().as_str() == "important" {
Ok(Value::Important) Ok(Value::Important)

View File

@ -96,3 +96,8 @@ test!(
"a {\n color: inspect((((((a))))));\n}\n", "a {\n color: inspect((((((a))))));\n}\n",
"a {\n color: a;\n}\n" "a {\n color: a;\n}\n"
); );
test!(
allow_spaces_after_exclamation_point,
"a {\n color: foo ! important;\n}\n",
"a {\n color: foo !important;\n}\n"
);