From 8e7eeada2a21ffe2eb59df2eb35dc88757435bc8 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 4 May 2023 16:58:03 +0200 Subject: [PATCH] drive by fixes --- src/compiler/compile/css/Selector.ts | 36 ++++++++----------- .../input.svelte | 8 ++--- .../warnings.json | 2 +- .../input.svelte | 8 ++--- .../warnings.json | 2 +- 5 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts index 705e341601..7c1652bb55 100644 --- a/src/compiler/compile/css/Selector.ts +++ b/src/compiler/compile/css/Selector.ts @@ -471,28 +471,22 @@ function get_element_parent(node: Element): Element | null { } /** - * Finds the given node's previous sibling in the DOM - * - * Unless the component is a custom element (web component), which in this - * case, the element is actually real, the Svelte is just a - * placeholder and is not actually real. Any children nodes in - * are 'flattened' and considered as the same level as the 's siblings - * - * e.g. - *

Heading 1

- * - *

Heading 2

- *
- * - * is considered to look like: - *

Heading 1

- *

Heading 2

- */ + * Finds the given node's previous sibling in the DOM + * + * The Svelte is just a placeholder and is not actually real. Any children nodes + * in are 'flattened' and considered as the same level as the 's siblings + * + * e.g. + *

Heading 1

+ * + *

Heading 2

+ *
+ * + * is considered to look like: + *

Heading 1

+ *

Heading 2

+ */ function find_previous_sibling(node: INode): INode { - if (node.component.compile_options.customElement) { - return node.prev; - } - let current_node: INode = node; do { if (current_node.type === 'Slot') { diff --git a/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte b/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte index 325841373f..455d1da170 100644 --- a/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte +++ b/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte @@ -8,13 +8,13 @@
diff --git a/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json b/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json index 0336660caf..936109f538 100644 --- a/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json +++ b/test/validator/samples/general-siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json @@ -1,7 +1,7 @@ [ { "code": "css-unused-selector", - "message": "Unused CSS selector \"h1 ~ p\"", + "message": "Unused CSS selector \"h1 ~ slot > p\"", "start": { "column": 1, "line": 12 diff --git a/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte b/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte index faf34125b1..0ec25f7ac4 100644 --- a/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte +++ b/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/input.svelte @@ -7,12 +7,12 @@ diff --git a/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json b/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json index 3ef66ebf60..9db06f8309 100644 --- a/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json +++ b/test/validator/samples/siblings-combinator-in-custom-element-selects-slot-fallback/warnings.json @@ -5,7 +5,7 @@ "column": 11, "line": 10 }, - "message": "Unused CSS selector \"h1 + span\"", + "message": "Unused CSS selector \"h1 + slot > span\"", "start": { "column": 2, "line": 10