&
is null
when at root
This commit is contained in:
parent
86c1bb704d
commit
d3413b7cbf
@ -372,9 +372,13 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
'&' => {
|
'&' => {
|
||||||
let span = self.toks.next().unwrap().pos();
|
let span = self.toks.next().unwrap().pos();
|
||||||
|
if self.super_selectors.is_empty() {
|
||||||
|
IntermediateValue::Value(Value::Null).span(span)
|
||||||
|
} else {
|
||||||
IntermediateValue::Value(self.super_selectors.last().clone().into_value())
|
IntermediateValue::Value(self.super_selectors.last().clone().into_value())
|
||||||
.span(span)
|
.span(span)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
'#' => {
|
'#' => {
|
||||||
if let Some(Token { kind: '{', pos }) = self.toks.peek_forward(1) {
|
if let Some(Token { kind: '{', pos }) = self.toks.peek_forward(1) {
|
||||||
self.span_before = *pos;
|
self.span_before = *pos;
|
||||||
|
@ -653,6 +653,11 @@ test!(
|
|||||||
":nth-child(ODD) {\n color: &;\n}\n",
|
":nth-child(ODD) {\n color: &;\n}\n",
|
||||||
":nth-child(odd) {\n color: :nth-child(odd);\n}\n"
|
":nth-child(odd) {\n color: :nth-child(odd);\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
super_selector_is_null_when_at_root,
|
||||||
|
"@mixin foo {\n #{if(&, 'true', 'false')} {\n color: red;\n }\n}\n\n@include foo;\n\na {\n @include foo;\n}\n",
|
||||||
|
"false {\n color: red;\n}\n\na true {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
a_n_plus_b_n_invalid_odd,
|
a_n_plus_b_n_invalid_odd,
|
||||||
":nth-child(ofdd) {\n color: &;\n}\n", "Error: Expected \"odd\"."
|
":nth-child(ofdd) {\n color: &;\n}\n", "Error: Expected \"odd\"."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user