Skip to content

Commit 65a4821

Browse files
committed
obsolete
1 parent 7aa3233 commit 65a4821

File tree

1 file changed

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

1 file changed

+6
-15
lines changed

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

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { get_attribute_chunks, is_text_attribute } from '../../../utils/ast.js';
1010
* stylesheet: Compiler.Css.StyleSheet;
1111
* element: Compiler.AST.RegularElement | Compiler.AST.SvelteElement;
1212
* from_render_tag: boolean;
13-
* inside_not: boolean;
1413
* }} State
1514
*/
1615
/** @typedef {NODE_PROBABLY_EXISTS | NODE_DEFINITELY_EXISTS} NodeExistsValue */
@@ -62,13 +61,9 @@ export function prune(stylesheet, element) {
6261
const parent = get_element_parent(element);
6362
if (!parent) return;
6463

65-
walk(
66-
stylesheet,
67-
{ stylesheet, element: parent, from_render_tag: true, inside_not: false },
68-
visitors
69-
);
64+
walk(stylesheet, { stylesheet, element: parent, from_render_tag: true }, visitors);
7065
} else {
71-
walk(stylesheet, { stylesheet, element, from_render_tag: false, inside_not: false }, visitors);
66+
walk(stylesheet, { stylesheet, element, from_render_tag: false }, visitors);
7267
}
7368
}
7469

@@ -227,7 +222,7 @@ function apply_selector(relative_selectors, rule, element, state) {
227222
// if this is the left-most non-global selector, mark it — we want
228223
// `x y z {...}` to become `x.blah y z.blah {...}`
229224
const parent = parent_selectors[parent_selectors.length - 1];
230-
if (!state.inside_not && (!parent || is_global(parent, rule))) {
225+
if (!parent || is_global(parent, rule)) {
231226
mark(relative_selector, element);
232227
}
233228

@@ -269,7 +264,7 @@ function apply_combinator(combinator, relative_selector, parent_selectors, rule,
269264
if (parent.type === 'RegularElement' || parent.type === 'SvelteElement') {
270265
if (apply_selector(parent_selectors, rule, parent, state)) {
271266
// TODO the `name === ' '` causes false positives, but removing it causes false negatives...
272-
if (!state.inside_not && (name === ' ' || crossed_component_boundary)) {
267+
if (name === ' ' || crossed_component_boundary) {
273268
mark(parent_selectors[parent_selectors.length - 1], parent);
274269
}
275270

@@ -295,15 +290,11 @@ function apply_combinator(combinator, relative_selector, parent_selectors, rule,
295290
if (possible_sibling.type === 'RenderTag' || possible_sibling.type === 'SlotElement') {
296291
// `{@render foo()}<p>foo</p>` with `:global(.x) + p` is a match
297292
if (parent_selectors.length === 1 && parent_selectors[0].metadata.is_global) {
298-
if (!state.inside_not) {
299-
mark(relative_selector, element);
300-
}
293+
mark(relative_selector, element);
301294
sibling_matched = true;
302295
}
303296
} else if (apply_selector(parent_selectors, rule, possible_sibling, state)) {
304-
if (!state.inside_not) {
305-
mark(relative_selector, element);
306-
}
297+
mark(relative_selector, element);
307298
sibling_matched = true;
308299
}
309300
}

0 commit comments

Comments
 (0)