drive by fixes

pull/7800/head
Simon H 3 years ago committed by GitHub
parent b65d94d388
commit 8e7eeada2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 <slot> element is actually real, the Svelte <slot> is just a
* placeholder and is not actually real. Any children nodes in <slot>
* are 'flattened' and considered as the same level as the <slot>'s siblings
*
* e.g.
* <h1>Heading 1</h1>
* <slot>
* <h2>Heading 2</h2>
* </slot>
*
* is considered to look like:
* <h1>Heading 1</h1>
* <h2>Heading 2</h2>
*/
* Finds the given node's previous sibling in the DOM
*
* The Svelte <slot> is just a placeholder and is not actually real. Any children nodes
* in <slot> are 'flattened' and considered as the same level as the <slot>'s siblings
*
* e.g.
* <h1>Heading 1</h1>
* <slot>
* <h2>Heading 2</h2>
* </slot>
*
* is considered to look like:
* <h1>Heading 1</h1>
* <h2>Heading 2</h2>
*/
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') {

@ -8,13 +8,13 @@
</slot>
<style>
/* This will not get picked up */
h1 ~ p {
/* This will not be picked up */
h1 ~ slot > p {
color: red;
}
/* This will be picked up */
h1 ~ slot > p {
/* This will get picked up */
h1 ~ p {
color: red;
}
</style>

@ -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

@ -7,12 +7,12 @@
<style>
/* This will not be picked up */
h1 + span {
color: red;
}
h1 + slot > span {
color: red;
}
/* This will be picked up */
h1 + slot > span {
h1 + span {
color: red;
}
</style>

@ -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

Loading…
Cancel
Save