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

Merge pull request #260 from le0pard/fix_microtask

Fix queueMicrotask working on already destroyed mask instance
This commit is contained in:
Alexander Shabunevich
2025-03-21 10:44:49 +03:00
committed by GitHub
+5 -1
View File
@@ -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)