From e6d428eb093051bfd634ed50c094569595f3d90b Mon Sep 17 00:00:00 2001 From: Daniel Regeci <536331+ovx@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:02:26 +0700 Subject: [PATCH] fix: properly remove event listeners in Component's removeEventListener --- packages/svelte/src/runtime/internal/Component.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/svelte/src/runtime/internal/Component.js b/packages/svelte/src/runtime/internal/Component.js index a0b0f5817217..bc2c83de3daf 100644 --- a/packages/svelte/src/runtime/internal/Component.js +++ b/packages/svelte/src/runtime/internal/Component.js @@ -220,6 +220,12 @@ if (typeof HTMLElement === 'function') { this.$$l_u.delete(listener); } } + if (this.$$l[type]) { + const idx = this.$$l[type].indexOf(listener); + if (idx >= 0) { + this.$$l[type].splice(idx, 1); + } + } } async connectedCallback() {