|
|
@@ -3,7 +3,7 @@
|
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
|
* Copyright (c) 2010 - 2017 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 4.0.1-1
|
|
|
+* Version: 4.0.1-2
|
|
|
*/
|
|
|
|
|
|
!function(factory) {
|
|
|
@@ -62,7 +62,6 @@
|
|
|
function getMaskTemplate(baseOnInput, minimalPos, includeMode) {
|
|
|
minimalPos = minimalPos || 0;
|
|
|
var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition();
|
|
|
- -1 === (maxLength = el !== undefined ? el.maxLength : undefined) && (maxLength = undefined);
|
|
|
do {
|
|
|
!0 === baseOnInput && getMaskSet().validPositions[pos] ? (testPos = getMaskSet().validPositions[pos],
|
|
|
test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(!0 === includeMode ? testPos.input : !1 === includeMode ? test.nativeDef : getPlaceholder(pos, test))) : (testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
|
|
@@ -940,7 +939,7 @@
|
|
|
if (selection.begin != selection.end || isMask(selection.begin) || (selection.end = caretPos.end),
|
|
|
"" !== backPart && selection.begin < selection.end) writeBuffer(input, getBuffer(), selection),
|
|
|
frontPart.charCodeAt(frontPart.length - 1) !== frontBufferPart.charCodeAt(frontBufferPart.length - 1) ? (e.which = frontPart.charCodeAt(frontPart.length - 1),
|
|
|
- EventHandlers.keypressEvent.call(input, e)) : (selection.begin == selection.end - 1 && caret(input, seekPrevious(selection.begin + 1), selection.end),
|
|
|
+ ignorable = !1, EventHandlers.keypressEvent.call(input, e)) : (selection.begin == selection.end - 1 && caret(input, seekPrevious(selection.begin + 1), selection.end),
|
|
|
e.keyCode = Inputmask.keyCode.DELETE, EventHandlers.keydownEvent.call(input, e)); else {
|
|
|
for (var bufferTemplate = getBufferTemplate().join(""); null === inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1);
|
|
|
inputValue = inputValue.replace(bufferTemplate, ""), $.isFunction(opts.onBeforeMask) && (inputValue = opts.onBeforeMask(inputValue, opts) || inputValue),
|
|
|
@@ -1016,7 +1015,7 @@
|
|
|
var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(lvclickPosition);
|
|
|
if (clickPosition < lastPosition) caret(input, isMask(clickPosition) || isMask(clickPosition - 1) ? clickPosition : seekNext(clickPosition)); else {
|
|
|
var placeholder = getPlaceholder(lastPosition), lvp = getMaskSet().validPositions[lvclickPosition], tt = getTestTemplate(lastPosition, lvp ? lvp.match.locator : undefined, lvp);
|
|
|
- if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier || !isMask(lastPosition) && tt.match.def === placeholder) {
|
|
|
+ if ("" !== placeholder && getBuffer()[lastPosition] !== placeholder && !0 !== tt.match.optionalQuantifier && !0 !== tt.match.newBlockMarker || !isMask(lastPosition) && tt.match.def === placeholder) {
|
|
|
var newPos = seekNext(lastPosition);
|
|
|
clickPosition >= newPos && (lastPosition = newPos);
|
|
|
}
|
|
|
@@ -1164,7 +1163,8 @@
|
|
|
}
|
|
|
}(input), isSupported;
|
|
|
}(elem, opts);
|
|
|
- if (!1 !== isSupported && (el = elem, $el = $(el), !0 === opts.colorMask && initializeColorMask(el),
|
|
|
+ if (!1 !== isSupported && (el = elem, $el = $(el), maxLength = el !== undefined ? el.maxLength : undefined,
|
|
|
+ -1 === maxLength && (maxLength = undefined), !0 === opts.colorMask && initializeColorMask(el),
|
|
|
android && (el.hasOwnProperty("inputmode") && (el.inputmode = opts.inputmode, el.setAttribute("inputmode", opts.inputmode)),
|
|
|
"rtfm" === opts.androidHack && (!0 !== opts.colorMask && initializeColorMask(el),
|
|
|
el.type = "password")), !0 === isSupported && (EventRuler.on(el, "submit", EventHandlers.submitEvent),
|
|
|
@@ -1175,7 +1175,7 @@
|
|
|
EventRuler.on(el, "dragdrop", EventHandlers.pasteEvent), EventRuler.on(el, "drop", EventHandlers.pasteEvent),
|
|
|
EventRuler.on(el, "cut", EventHandlers.cutEvent), EventRuler.on(el, "complete", opts.oncomplete),
|
|
|
EventRuler.on(el, "incomplete", opts.onincomplete), EventRuler.on(el, "cleared", opts.oncleared),
|
|
|
- android || !0 === opts.inputEventOnly || (EventRuler.on(el, "keydown", EventHandlers.keydownEvent),
|
|
|
+ android || !0 === opts.inputEventOnly ? el.removeAttribute("maxLength") : (EventRuler.on(el, "keydown", EventHandlers.keydownEvent),
|
|
|
EventRuler.on(el, "keypress", EventHandlers.keypressEvent)), EventRuler.on(el, "compositionstart", $.noop),
|
|
|
EventRuler.on(el, "compositionupdate", $.noop), EventRuler.on(el, "compositionend", $.noop),
|
|
|
EventRuler.on(el, "keyup", $.noop), EventRuler.on(el, "input", EventHandlers.inputFallBackEvent),
|