2
0
mirror of https://github.com/tenrok/maska.git synced 2026-05-15 11:59:38 +03:00

fix: change event abort to manual event removing

Because happy-dom can't handle event abortion and test do not passing
This commit is contained in:
Alexander Shabunevich
2024-04-14 12:12:13 +03:00
parent 04bd6b249c
commit 88d92b2753
+4 -6
View File
@@ -18,7 +18,6 @@ export interface MaskaDetail {
export class MaskInput {
readonly items = new Map<HTMLInputElement, Mask>()
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))