properly handle interpolation in selectors
This commit is contained in:
parent
57a704172f
commit
31ec0cc7f8
@ -600,9 +600,8 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
|
|||||||
}
|
}
|
||||||
'#' => {
|
'#' => {
|
||||||
values.push(toks.next().unwrap());
|
values.push(toks.next().unwrap());
|
||||||
let next = toks.next().unwrap();
|
if toks.peek().unwrap().kind == '{' {
|
||||||
values.push(next);
|
values.push(toks.next().unwrap());
|
||||||
if next.kind == '{' {
|
|
||||||
values.extend(eat_interpolation(toks));
|
values.extend(eat_interpolation(toks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ impl<'a> SelectorParser<'a> {
|
|||||||
}
|
}
|
||||||
'#' => {
|
'#' => {
|
||||||
tokens.next();
|
tokens.next();
|
||||||
if tokens.peek().unwrap().kind == '{' {
|
if tokens.peek().is_some() && tokens.peek().unwrap().kind == '{' {
|
||||||
tokens.next();
|
tokens.next();
|
||||||
self.is_interpolated = true;
|
self.is_interpolated = true;
|
||||||
self.tokens_to_selectors(
|
self.tokens_to_selectors(
|
||||||
|
@ -305,3 +305,8 @@ test!(
|
|||||||
// );
|
// );
|
||||||
test!(allows_id_start_with_number, "#2foo {\n color: red;\n}\n");
|
test!(allows_id_start_with_number, "#2foo {\n color: red;\n}\n");
|
||||||
test!(allows_id_only_number, "#2 {\n color: red;\n}\n");
|
test!(allows_id_only_number, "#2 {\n color: red;\n}\n");
|
||||||
|
test!(
|
||||||
|
id_interpolation,
|
||||||
|
"$zzz: zzz;\n##{$zzz} {\n a: b;\n}\n",
|
||||||
|
"#zzz {\n a: b;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user