Only assign RegExp if property is different from false
This commit is contained in:
parent
04f75fc30d
commit
0bb7a2bdf6
1 changed files with 3 additions and 1 deletions
|
|
@ -58,7 +58,9 @@ class Input extends Canvas {
|
|||
this.tabKeyBlur = false
|
||||
})
|
||||
var asYouType = this.getProp('asYouType')
|
||||
this.fieldValidator = new RegExp('[^'+this.getProp('fieldValidator')+']', 'g')
|
||||
if (this.getProp('fieldValidator')) {
|
||||
this.fieldValidator = new RegExp('[^'+this.getProp('fieldValidator')+']', 'g')
|
||||
}
|
||||
this.input.addEventListener('keydown', (e)=>{
|
||||
if (e.keyCode === 13) this.blur() // enter
|
||||
else if (e.keyCode === 27) this.blur(false) // esc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue