Skip to content

Commit 6287e03

Browse files
committed
Changing keypress handler to depend on the 'which' property.
From the jQuery docs: "jQuery normalizes the .which property so you can reliably use it to retrieve the character code"
1 parent be216d4 commit 6287e03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/jquery.maskedinput.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@
144144
//Fixes Mac FF bug on backspace
145145
return (e.keyCode == 8) ? false : null;
146146
}
147-
e = e || window.event;
148-
var k = e.charCode || e.keyCode || e.which;
147+
148+
var k = e.which;
149149
var pos = $(this).caret();
150150

151151
if (e.ctrlKey || e.altKey || e.metaKey) {//Ignore
152152
return true;
153-
} else if ((k >= 32 && k <= 125) || k > 186) {//typeable characters
153+
} else if (k) {//typeable characters
154154
var p = seekNext(pos.begin - 1);
155155
if (p < len) {
156156
var c = String.fromCharCode(k);

0 commit comments

Comments
 (0)