resolve issue with @ at-root
This commit is contained in:
parent
2cd81ccb0f
commit
5eeee2f01f
@ -1,3 +1,6 @@
|
|||||||
|
# 0.9.1
|
||||||
|
- fix issue in which `@at-root` would panic when placed after a ruleset
|
||||||
|
|
||||||
# 0.9.0
|
# 0.9.0
|
||||||
|
|
||||||
This release is focused on setting up the groundwork for implementing `@extend` as well
|
This release is focused on setting up the groundwork for implementing `@extend` as well
|
||||||
|
@ -114,7 +114,8 @@ impl Css {
|
|||||||
Stmt::UnknownAtRule {
|
Stmt::UnknownAtRule {
|
||||||
params, name, body, ..
|
params, name, body, ..
|
||||||
} => vec![Toplevel::UnknownAtRule { params, name, body }],
|
} => vec![Toplevel::UnknownAtRule { params, name, body }],
|
||||||
Stmt::Return(..) | Stmt::AtRoot { .. } => unreachable!(),
|
Stmt::Return(..) => unreachable!("@return: {:?}", stmt),
|
||||||
|
Stmt::AtRoot { .. } => unreachable!("@at-root: {:?}", stmt),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,6 +283,7 @@ impl<'a> Parser<'a> {
|
|||||||
let body = self.parse_stmt()?;
|
let body = self.parse_stmt()?;
|
||||||
self.scopes.pop();
|
self.scopes.pop();
|
||||||
self.super_selectors.pop();
|
self.super_selectors.pop();
|
||||||
|
self.at_root = self.super_selectors.is_empty();
|
||||||
stmts.push(Stmt::RuleSet {
|
stmts.push(Stmt::RuleSet {
|
||||||
selector,
|
selector,
|
||||||
body,
|
body,
|
||||||
|
@ -63,3 +63,8 @@ test!(
|
|||||||
"test {\n @at-root {\n #{&} {\n foo {\n bar: baz;\n }\n }\n }\n}\n",
|
"test {\n @at-root {\n #{&} {\n foo {\n bar: baz;\n }\n }\n }\n}\n",
|
||||||
"test foo {\n bar: baz;\n}\n"
|
"test foo {\n bar: baz;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
style_before_at_root,
|
||||||
|
"a {}\n\n@at-root {\n @-ms-viewport { width: device-width; }\n}\n",
|
||||||
|
"@-ms-viewport {\n width: device-width;\n}\n"
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user