RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.39k stars 2.17k forks source link

error message: Cannot read properties of undefined (reading 'allowMinus') #2642

Closed WenSheng-tw closed 2 years ago

WenSheng-tw commented 2 years ago

< input type="text" id="ieFD_PKG" style="display: inline-block; width: 35px; height: 26px; z-index: 17; text-align: right; background: white; border-color: rgb(224, 224, 224);" name="ieFD_PKG" value="" spellcheck="false" inputmode="numeric" maxlength="2" >

type number '1' or '23' and other number, and press keyboard 'backspace' many time. chrome console is show: Cannot read properties of undefined (reading 'allowMinus')

I found solution: line 1165: old code is: return n.allowMinus && e === n.negationSymbol.back;

change to: if(typeof(n) == 'object'){ return n.allowMinus && e === n.negationSymbol.back; }else{ return false; } and modify line 1160: old code is: return n.allowMinus && ("-" === e || e === n.negationSymbol.front); change to: if(typeof(n) == 'object'){ return n.allowMinus && ("-" === e || e === n.negationSymbol.front); }else{ return false; }

RobinHerbots commented 2 years ago

@WenSheng-tw,

The isssue is fixed in version "5.0.8-beta.37"