mirror of https://github.com/sveltejs/svelte
fix: properly hydrate dynamic css props components and remove element removal (#16118)
parent
91272d702b
commit
90807ca18d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: properly hydrate dynamic css props components and remove element removal
|
@ -0,0 +1,7 @@
|
||||
<div>a</div>
|
||||
|
||||
<style>
|
||||
div{
|
||||
color: var(--prop);
|
||||
}
|
||||
</style>
|
@ -0,0 +1,7 @@
|
||||
<div>b</div>
|
||||
|
||||
<style>
|
||||
div{
|
||||
color: var(--prop);
|
||||
}
|
||||
</style>
|
@ -0,0 +1,16 @@
|
||||
import { test } from '../../assert';
|
||||
import { flushSync } from 'svelte';
|
||||
|
||||
export default test({
|
||||
warnings: [],
|
||||
async test({ assert, target }) {
|
||||
const btn = target.querySelector('button');
|
||||
let div = /** @type {HTMLElement} */ (target.querySelector('div'));
|
||||
assert.equal(getComputedStyle(div).color, 'rgb(255, 0, 0)');
|
||||
flushSync(() => {
|
||||
btn?.click();
|
||||
});
|
||||
div = /** @type {HTMLElement} */ (target.querySelector('div'));
|
||||
assert.equal(getComputedStyle(div).color, 'rgb(255, 0, 0)');
|
||||
}
|
||||
});
|
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
import A from "./B.svelte";
|
||||
import B from "./A.svelte";
|
||||
let value = $state(0);
|
||||
|
||||
let Comp = $derived(value % 2 === 0 ? A : B);
|
||||
</script>
|
||||
|
||||
<button onclick={()=>value++}>click</button>
|
||||
|
||||
<Comp --prop="red"/>
|
Loading…
Reference in new issue