mirror of https://github.com/sveltejs/svelte
parent
7bc0a70fe6
commit
214dd3d005
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: cancel deferred event listeners during cleanup
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<svelte:document onpointerdown={() => console.log('template')} />
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, logs }) {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve));
|
||||||
|
assert.deepEqual(logs, []);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<script>
|
||||||
|
import { mount, onMount, unmount } from 'svelte';
|
||||||
|
import { on } from 'svelte/events';
|
||||||
|
import Child from './Child.svelte';
|
||||||
|
|
||||||
|
let target;
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
const off = on(document, 'wheel', () => console.log('on'));
|
||||||
|
off();
|
||||||
|
|
||||||
|
const child = mount(Child, { target });
|
||||||
|
unmount(child);
|
||||||
|
|
||||||
|
await Promise.resolve();
|
||||||
|
document.dispatchEvent(new Event('wheel'));
|
||||||
|
document.dispatchEvent(new Event('pointerdown'));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div bind:this={target}></div>
|
||||||
Loading…
Reference in new issue