&
is null inside selectors at root
This commit is contained in:
parent
3e8b038705
commit
5bcf499942
@ -77,7 +77,6 @@ impl ContextFlags {
|
||||
(self.0 & Self::IN_KEYFRAMES) != 0
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn in_at_root_rule(self) -> bool {
|
||||
(self.0 & Self::IN_AT_ROOT_RULE) != 0
|
||||
}
|
||||
|
@ -778,7 +778,10 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
'&' => {
|
||||
let span = self.toks.next().unwrap().pos();
|
||||
if self.super_selectors.is_empty() && !self.at_root_has_selector && !self.at_root {
|
||||
if self.super_selectors.is_empty()
|
||||
&& !self.at_root_has_selector
|
||||
&& !self.flags.in_at_root_rule()
|
||||
{
|
||||
IntermediateValue::Value(HigherIntermediateValue::Literal(Value::Null))
|
||||
.span(span)
|
||||
} else {
|
||||
|
@ -171,6 +171,15 @@ test!(
|
||||
/**/ ",
|
||||
"/**/\n/**/\n/**/\n"
|
||||
);
|
||||
test!(
|
||||
parent_selector_is_null_at_root,
|
||||
"@if & {
|
||||
a {
|
||||
color: red;
|
||||
}
|
||||
}",
|
||||
""
|
||||
);
|
||||
error!(
|
||||
nothing_after_escape,
|
||||
"@if \\", "Error: Expected expression."
|
||||
|
@ -676,6 +676,11 @@ test!(
|
||||
":a(a , b) {\n color: &;\n}\n",
|
||||
":a(a , b) {\n color: :a(a , b);\n}\n"
|
||||
);
|
||||
test!(
|
||||
parent_selector_is_null_at_root,
|
||||
"#{inspect(&)} {\n color: &;\n}\n",
|
||||
"null {\n color: null;\n}\n"
|
||||
);
|
||||
error!(
|
||||
a_n_plus_b_n_invalid_odd,
|
||||
":nth-child(ofdd) {\n color: &;\n}\n", "Error: Expected \"odd\"."
|
||||
|
Loading…
x
Reference in New Issue
Block a user