fix sibling combinators with spread attributes (#5467)

pull/5472/head
Tan Li Hau 4 years ago committed by GitHub
parent 296e81af4d
commit 3970def5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@
## Unreleased
* Add `EventSource` to known globals ([#5463](https://github.com/sveltejs/svelte/issues/5463))
* Fix compiler exception with `~`/`+` combinators and `{...spread}` attributes ([#5465](https://github.com/sveltejs/svelte/issues/5465))
## 3.28.0

@ -406,7 +406,7 @@ function get_possible_element_siblings(node: INode, adjacent_only: boolean): Map
let prev: INode = node;
while (prev = prev.prev) {
if (prev.type === 'Element') {
if (!prev.attributes.find(attr => attr.name.toLowerCase() === 'slot')) {
if (!prev.attributes.find(attr => attr.type === 'Attribute' && attr.name.toLowerCase() === 'slot')) {
result.set(prev, NodeExist.Definitely);
}

@ -0,0 +1 @@
input.svelte-xyz:focus+div.svelte-xyz{color:red}input.svelte-xyz:focus~div.svelte-xyz{color:red}

@ -0,0 +1,2 @@
<input placeholder="Text" class="svelte-xyz">
<div class="svelte-xyz">Should be red, when input is focused</div>

@ -0,0 +1,11 @@
<script>
const test = { placeholder: 'Text' };
</script>
<style>
input:focus + div { color: red; }
input:focus ~ div { color: red; }
</style>
<input {...test}>
<div>Should be red, when input is focused</div>
Loading…
Cancel
Save