resolve panic when extending certain psuedo selectors containing combinators without rhs selector

This commit is contained in:
Connor Skees 2020-08-04 23:18:16 -04:00
parent 5c8e88d16b
commit b2e7270681
2 changed files with 15 additions and 1 deletions

View File

@ -186,7 +186,13 @@ fn weave_parents(
for group in lcs {
choices.push(
chunks(&mut groups_one, &mut groups_two, |sequence| {
complex_is_parent_superselector(sequence.get(0).unwrap().clone(), group.clone())
complex_is_parent_superselector(
match sequence.get(0) {
Some(v) => v.clone(),
None => return true,
},
group.clone(),
)
})
.into_iter()
.map(|chunk| chunk.into_iter().flatten().collect())

View File

@ -1874,6 +1874,14 @@ test!(
}",
"foo, a:current(foo),\n:current(foo) {\n color: black;\n}\n"
);
test!(
extend_pseudo_selector_class_containing_combinator_without_rhs_selector,
":has(a >) b {
@extend b;
color: red;
}",
":has(a >) b, :has(a >) :has(a >) :has(a >) b, :has(a >) :has(a >) :has(a >) b {\n color: red;\n}\n"
);
// todo: extend_loop (massive test)
// todo: extend tests in folders