Fix issue where we can't find previous sibling because of nested slots

pull/8422/head
Nguyen Tran 4 years ago
parent c4200dceb3
commit 451612141d

@ -483,11 +483,11 @@ function find_previous_sibling_ignoring_slots(node: INode): INode {
} }
// @ts-ignore // @ts-ignore
if (!current_node.prev && current_node.parent.type === 'Slot') { while (!current_node.prev && current_node.parent && current_node.parent.type === 'Slot') {
current_node = current_node.parent.prev; current_node = current_node.parent;
} else {
current_node = current_node.prev;
} }
current_node = current_node.prev;
// @ts-ignore // @ts-ignore
} while (current_node && current_node.type === 'Slot'); } while (current_node && current_node.type === 'Slot');

@ -0,0 +1,7 @@
<slot><slot><h1>Heading 1</h1></slot></slot><span>Span 1</span><span>Span 2</span><slot><slot><p>Paragraph 2</p></slot></slot>
<style>
h1 ~ p {
color: red;
}
</style>

@ -0,0 +1,7 @@
<slot><slot><slot><h1>test</h1></slot></slot></slot><slot><slot><span>Hello</span></slot></slot>
<style>
h1 + span {
color: red;
}
</style>
Loading…
Cancel
Save