more accurate pruning

pull/14456/head
Rich Harris 2 years ago
parent 344c132813
commit 1dd8772eac

@ -231,11 +231,16 @@ function apply_combinator(combinator, relative_selector, parent_selectors, rule,
} }
if (parent.type === 'SnippetBlock') { if (parent.type === 'SnippetBlock') {
// We assume the snippet might be rendered in a place where the parent selectors match. for (const site of parent.metadata.sites) {
// (We could do more static analysis and check the render tag reference to see if this snippet block continues if (
// with elements that actually match the selector, but that would be a lot of work for little gain) apply_combinator(combinator, relative_selector, parent_selectors, rule, site, state)
) {
return true; return true;
} }
}
return false;
}
if (parent.type === 'RegularElement' || parent.type === 'SvelteElement') { if (parent.type === 'RegularElement' || parent.type === 'SvelteElement') {
if (apply_selector(parent_selectors, rule, parent, state)) { if (apply_selector(parent_selectors, rule, parent, state)) {

Loading…
Cancel
Save