diff --git a/.changeset/bright-berries-smell.md b/.changeset/bright-berries-smell.md new file mode 100644 index 0000000000..f1fdb4aa81 --- /dev/null +++ b/.changeset/bright-berries-smell.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: remove correct event listener from document diff --git a/packages/svelte/src/internal/client/render.js b/packages/svelte/src/internal/client/render.js index e1b385cd21..d18876b373 100644 --- a/packages/svelte/src/internal/client/render.js +++ b/packages/svelte/src/internal/client/render.js @@ -265,7 +265,7 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro return () => { for (const event_name of registered_events) { target.removeEventListener(event_name, bound_event_listener); - document.removeEventListener(event_name, bound_event_listener); + document.removeEventListener(event_name, bound_document_event_listener); } root_event_handles.delete(event_handle); mounted_components.delete(component);