diff --git a/src/selector/extend/functions.rs b/src/selector/extend/functions.rs index ccd1383..548173a 100644 --- a/src/selector/extend/functions.rs +++ b/src/selector/extend/functions.rs @@ -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()) diff --git a/tests/extend.rs b/tests/extend.rs index 2f6c52d..47d0ab1 100644 --- a/tests/extend.rs +++ b/tests/extend.rs @@ -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