From 88d92b27532ed6085a3071d66c09e1a3a5174414 Mon Sep 17 00:00:00 2001 From: Alexander Shabunevich Date: Sun, 14 Apr 2024 12:12:13 +0300 Subject: [PATCH] fix: change event abort to manual event removing Because happy-dom can't handle event abortion and test do not passing --- src/input.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/input.ts b/src/input.ts index 4bf1be5..31a3b7c 100644 --- a/src/input.ts +++ b/src/input.ts @@ -18,7 +18,6 @@ export interface MaskaDetail { export class MaskInput { readonly items = new Map() - private readonly abort = new AbortController() constructor (target: MaskaTarget, private options: MaskInputOptions = {}) { this.init(this.getInputs(target)) @@ -38,7 +37,9 @@ export class MaskInput { } destroy (): void { - this.abort.abort() + for (const input of this.items.keys()) { + input.removeEventListener('input', this.onInput) + } this.items.clear() } @@ -47,10 +48,7 @@ export class MaskInput { for (const input of inputs) { if (!this.items.has(input)) { - input.addEventListener('input', this.onInput, { - signal: this.abort.signal, - capture: true - }) + input.addEventListener('input', this.onInput, { capture: true }) } const mask = new Mask(parseInput(input, defaults))