fix: remove document event listeners on unmount (#12105)

pull/12109/head
Dominic Gannaway 5 months ago committed by GitHub
parent baad4ea320
commit 7f087c4b03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: remove document event listeners on unmount

@ -251,6 +251,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);
}
root_event_handles.delete(event_handle);
mounted_components.delete(component);

Loading…
Cancel
Save