mirror of https://github.com/sveltejs/svelte
event_context (#13737)
parent
fb052be96e
commit
be02b7e54c
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure event context is reset before invoking callback
|
@ -0,0 +1,14 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
test({ assert, target, logs }) {
|
||||
const [b1] = target.querySelectorAll('button');
|
||||
|
||||
b1?.click();
|
||||
b1?.click();
|
||||
b1?.click();
|
||||
flushSync();
|
||||
assert.htmlEqual(target.innerHTML, '<button>4</button>');
|
||||
}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
let count = $state(0);
|
||||
let button = $state();
|
||||
|
||||
function do_thing() {
|
||||
button?.click();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button bind:this={button} onclick={() => count++ }>{count}</button>
|
||||
|
||||
{#if do_thing()}{/if}
|
Loading…
Reference in new issue