Handle no space between colon when also missing semicolon

This commit is contained in:
ConnorSkees 2020-02-01 23:22:36 -05:00
parent b8bacbde8b
commit bad318aae8
2 changed files with 13 additions and 0 deletions

View File

@ -527,6 +527,14 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
toks.next();
devour_whitespace(toks);
return Ok(None);
} else {
// special edge case where there was no space between the colon
// and no semicolon following the style
// in a style `color:red`. todo: refactor
let mut v = values.clone().into_iter().peekable();
let property = Style::parse_property(&mut v, scope, super_selector, String::new());
let value = Style::parse_value(&mut v, scope, super_selector);
return Ok(Some(Expr::Style(Style { property, value })));
}
}
TokenKind::Symbol(Symbol::OpenCurlyBrace) => {

View File

@ -125,3 +125,8 @@ test!(
"a {\n color:red;\n}\n",
"a {\n color: red;\n}\n"
);
test!(
no_space_between_colon_no_semicolon,
"a {\n color:red\n}\n",
"a {\n color: red;\n}\n"
);