Skip to content

Commit

Permalink
chrome test
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinHerbots committed Mar 3, 2014
1 parent bb9c5a1 commit 0b90612
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 131 deletions.
Binary file modified dist/jQuery.InputMask.2.5.0.nupkg
Binary file not shown.
13 changes: 11 additions & 2 deletions dist/jquery.inputmask.bundle.js
Expand Up @@ -1188,19 +1188,28 @@
//backspace in chrome32 only fires input event - detect & treat
var caretPos = caret(input),
currentValue = input._valueGet();

//correct caretposition for chrome
if (caretPos.begin > currentValue.length) {
caret(input, currentValue.length);
caretPos = caret(input);
}
if ((getActiveBuffer().length - currentValue.length) == 1 && currentValue.charAt(caretPos.begin) != getActiveBuffer()[caretPos.begin]
&& currentValue.charAt(caretPos.begin + 1) != getActiveBuffer()[caretPos.begin]
&& !isMask(caretPos.begin)) {
e.keyCode = opts.keyCode.BACKSPACE;
keydownEvent.call(input, e);
} else { //nonnumerics don't fire keypress
checkVal(input, false, false);
currentValue = currentValue.replace(new RegExp("(" + escapeRegex(getActiveBufferTemplate().join('')) + ")*"), "");
checkVal(input, false, false, currentValue.split(''));
writeBuffer(input, getActiveBuffer());
if (isComplete(getActiveBuffer()) === true)
$input.trigger("complete");
$input.click();
}
setTimeout(function () {
writeBuffer(input, getActiveBuffer());
$input.click();
}, 0);
e.preventDefault();
}

Expand Down

0 comments on commit 0b90612

Please sign in to comment.