Skip to content

Commit 610c891

Browse files
committed
another
1 parent c005c08 commit 610c891

File tree

1 file changed

+6
-5
lines changed
  • packages/svelte/src/compiler/phases/2-analyze/css

1 file changed

+6
-5
lines changed

packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,15 @@ function apply_combinator(combinator, relative_selector, parent_selectors, rule,
260260
switch (name) {
261261
case ' ':
262262
case '>': {
263-
let parent = /** @type {Compiler.TemplateNode | null} */ (element.parent);
264-
265263
let parent_matched = false;
266264
let crossed_component_boundary = false;
267265

268-
while (parent) {
266+
const path = element.metadata.path;
267+
let i = path.length;
268+
269+
while (i--) {
270+
const parent = path[i];
271+
269272
if (parent.type === 'Component' || parent.type === 'SvelteComponent') {
270273
crossed_component_boundary = true;
271274
}
@@ -289,8 +292,6 @@ function apply_combinator(combinator, relative_selector, parent_selectors, rule,
289292

290293
if (name === '>') return parent_matched;
291294
}
292-
293-
parent = /** @type {Compiler.TemplateNode | null} */ (parent.parent);
294295
}
295296

296297
return parent_matched || parent_selectors.every((selector) => is_global(selector, rule));

0 commit comments

Comments
 (0)