From 85c688287a075732d27c760a09dfae5924abda08 Mon Sep 17 00:00:00 2001 From: Alexey Vasiliev Date: Wed, 19 Mar 2025 14:16:31 +0200 Subject: [PATCH] Fix queueMicrotask working on already destroyed mask instance --- src/input.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/input.ts b/src/input.ts index e47b34e..8ced5e9 100644 --- a/src/input.ts +++ b/src/input.ts @@ -53,7 +53,11 @@ export class MaskInput { const mask = new Mask(parseInput(input, defaults)) this.items.set(input, mask) - queueMicrotask(() => this.updateValue(input)) + queueMicrotask(() => { + if (document.body.contains(input)) { + this.updateValue(input) + } + }) if (input.selectionStart === null && mask.isEager()) { console.warn('Maska: input of `%s` type is not supported', input.type)