mirror of https://github.com/sveltejs/svelte
Continuation of #14194, fixes #15742binding-evt-without-context
parent
bfb969a6cc
commit
d34b1be9be
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure more bindings run without active context
|
@ -1,24 +1,29 @@
|
|||||||
<script>
|
<script>
|
||||||
let bar = $state('');
|
let bar = $state('');
|
||||||
|
|
||||||
const foo = {
|
const value = {
|
||||||
set bar(v) {
|
set value(v) {
|
||||||
|
console.log('bind:value ' + $effect.tracking());
|
||||||
console.log($effect.tracking());
|
|
||||||
|
|
||||||
bar = v;
|
bar = v;
|
||||||
},
|
},
|
||||||
get bar() {
|
get value() {
|
||||||
return bar;
|
return bar;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const active = {
|
||||||
|
set bar(_v) {
|
||||||
|
console.log('bind:activeElement ' + $effect.tracking());
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let input;
|
let input;
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
input.value = 'everybody';
|
input.value = 'everybody';
|
||||||
input.dispatchEvent(new window.Event('input'));
|
input.dispatchEvent(new window.Event('input'));
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input type="text" bind:value={foo.bar} bind:this={input}>
|
<svelte:document bind:activeElement={active.bar} />
|
||||||
|
<input type="text" bind:value={value.value} bind:this={input}>
|
||||||
|
Loading…
Reference in new issue