diff --git a/src/value/parse.rs b/src/value/parse.rs index 34f2f73..354055f 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -647,7 +647,7 @@ impl Value { }; let unit = if let Some(tok) = toks.peek() { match tok.kind { - 'a'..='z' | 'A'..='Z' | '_' => { + 'a'..='z' | 'A'..='Z' | '_' | '\\' => { let u = match eat_ident_no_interpolation(toks, true) { Ok(v) => v, Err(e) => return Some(Err(e)), diff --git a/tests/units.rs b/tests/units.rs index 5612fef..76c837e 100644 --- a/tests/units.rs +++ b/tests/units.rs @@ -74,6 +74,16 @@ test!( "a {\n color: 1px-2px;\n}\n", "a {\n color: -1px;\n}\n" ); +test!( + unit_starts_with_escape_sequence, + "a {\n color: 1\\9;\n}\n", + "a {\n color: 1\\9 ;\n}\n" +); +test!( + unit_fn_starts_with_escape_sequence, + "a {\n color: unit(1\\9);\n}\n", + "a {\n color: \"\\\\9 \";\n}\n" +); error!( display_single_mul, "a {\n color: 1rem * 1px;\n}\n", "Error: 1rem*px isn't a valid CSS value."