input-number
Advanced tools
Comparing version 1.1.0 to 1.1.1
30
index.js
@@ -11,3 +11,4 @@ /** | ||
38: 'up', | ||
40: 'down' | ||
40: 'down', | ||
13: 'enter' | ||
}; | ||
@@ -27,3 +28,7 @@ const numRE = /[\-\.0-9]/; | ||
input.removeEventListener('keydown', input._inputNumber) | ||
if (input._inputNumber) { | ||
input.removeEventListener('keydown', input._inputNumber) | ||
input.removeEventListener('blur', input._inputNumber.change) | ||
} | ||
input.addEventListener('keydown', keydown) | ||
@@ -36,2 +41,8 @@ | ||
if (key === 'enter') { | ||
let changeEvent = new Event('change'); | ||
input.dispatchEvent(changeEvent); | ||
return; | ||
} | ||
e.preventDefault(); | ||
@@ -88,14 +99,17 @@ | ||
focused = true; | ||
input.addEventListener('blur', function change () { | ||
input.removeEventListener('blur', change); | ||
let changeEvent = new Event('change'); | ||
input.dispatchEvent(changeEvent); | ||
focused = false; | ||
}); | ||
input.addEventListener('blur', change); | ||
} | ||
} | ||
keydown.change = change | ||
function change () { | ||
input.removeEventListener('blur', change); | ||
let changeEvent = new Event('change'); | ||
input.dispatchEvent(changeEvent); | ||
focused = false; | ||
} | ||
input._inputNumber = keydown | ||
return input; | ||
} |
{ | ||
"name": "input-number", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Make input recognize numbers", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"caret-position2": "^1.0.2", | ||
"caret-position2": "^1.0.3", | ||
"mumath": "^2.3.0" | ||
@@ -30,0 +30,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5391
127
Updatedcaret-position2@^1.0.3