Skip to content

Commit b8bc710

Browse files
author
Igor Escobar
committed
fixing mask positioning delays
1 parent 1ef022a commit b8bc710

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/jquery.mask.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,15 @@
254254
var keyCode = el.data('mask-keycode');
255255

256256
if ($.inArray(keyCode, jMask.byPassKeys) === -1) {
257-
var newVal = p.getMasked(),
258-
caretPos = p.getCaret();
257+
var newVal = p.getMasked();
259258

260259
// this is a compensation to devices/browsers that don't compensate
261260
// caret positioning the right way
262261
setTimeout(function() {
263262
p.setCaret(p.calculateCaretPosition());
264-
}, 10);
263+
}, $.jMaskGlobals.keyStrokeCompensation);
265264

266265
p.val(newVal);
267-
p.setCaret(caretPos);
268266
return p.callbacks(e);
269267
}
270268
},
@@ -568,6 +566,7 @@
568566
dataMask: true,
569567
watchInterval: 300,
570568
watchInputs: true,
569+
keyStrokeCompensation: 10,
571570
// old versions of chrome dont work great with input event
572571
useInput: !/Chrome\/[2-4][0-9]|SamsungBrowser/.test(window.navigator.userAgent) && eventSupported('input'),
573572
watchDataMask: false,

0 commit comments

Comments
 (0)