|
1 | 1 | /** |
2 | 2 | * jquery.mask.js |
3 | | - * @version: v1.14.13 |
| 3 | + * @version: v1.14.14 |
4 | 4 | * @author: Igor Escobar |
5 | 5 | * |
6 | 6 | * Created by Igor Escobar on 2012-03-10. Please report any bug at github.com/igorescobar/jQuery-Mask-Plugin |
|
254 | 254 | var keyCode = el.data('mask-keycode'); |
255 | 255 |
|
256 | 256 | if ($.inArray(keyCode, jMask.byPassKeys) === -1) { |
257 | | - var newVal = p.getMasked(), |
258 | | - caretPos = p.getCaret(); |
| 257 | + var newVal = p.getMasked(); |
259 | 258 |
|
260 | 259 | // this is a compensation to devices/browsers that don't compensate |
261 | 260 | // caret positioning the right way |
262 | 261 | setTimeout(function() { |
263 | 262 | p.setCaret(p.calculateCaretPosition()); |
264 | | - }, 10); |
| 263 | + }, $.jMaskGlobals.keyStrokeCompensation); |
265 | 264 |
|
266 | 265 | p.val(newVal); |
267 | | - p.setCaret(caretPos); |
268 | 266 | return p.callbacks(e); |
269 | 267 | } |
270 | 268 | }, |
|
395 | 393 | jMask.options = options; |
396 | 394 | jMask.remove = function() { |
397 | 395 | var caret = p.getCaret(); |
| 396 | + if (jMask.options.placeholder) { |
| 397 | + el.removeAttr('placeholder'); |
| 398 | + } |
| 399 | + if (el.data('mask-maxlength')) { |
| 400 | + el.removeAttr('maxlength'); |
| 401 | + } |
398 | 402 | p.destroyEvents(); |
399 | 403 | p.val(jMask.getCleanVal()); |
400 | 404 | p.setCaret(caret); |
|
449 | 453 | } |
450 | 454 |
|
451 | 455 | if (maxlength) { |
452 | | - el.attr('maxlength', mask.length); |
| 456 | + el.attr('maxlength', mask.length).data('mask-maxlength', true); |
453 | 457 | } |
454 | 458 |
|
455 | 459 | p.destroyEvents(); |
|
568 | 572 | dataMask: true, |
569 | 573 | watchInterval: 300, |
570 | 574 | watchInputs: true, |
| 575 | + keyStrokeCompensation: 10, |
571 | 576 | // old versions of chrome dont work great with input event |
572 | 577 | useInput: !/Chrome\/[2-4][0-9]|SamsungBrowser/.test(window.navigator.userAgent) && eventSupported('input'), |
573 | 578 | watchDataMask: false, |
|
0 commit comments