Browse Source

jquery.inputmask 3.3.2

Robin Herbots 9 years ago
parent
commit
a9b96c5564

+ 1 - 1
CHANGELOG.md

@@ -1,7 +1,7 @@
 # Change Log
 All notable changes to this project will be documented in this file.
 
-## [UNRELEASED]
+## [3.3.2 - 2016-09-09]
 
 ### Added
 - mask-level casing => #1352

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.3.2-123",
+  "version": "3.3.2",
   "main": [
     "./dist/inputmask/inputmask.js"
   ],

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
   "name": "jquery_inputmask",
   "repository": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.3.2-123",
+  "version": "3.3.2",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "main": "./dist/jquery.inputmask.bundle.js",
   "scripts": [

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.3.2-123",
+  "version": "3.3.2",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/jquery.inputmask",

+ 1 - 1
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 0 - 12
dist/inputmask/inputmask.dependencyLib.jquery.js

@@ -1,12 +0,0 @@
-/*!
-* inputmask.dependencyLib.jquery.js
-* https://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
-*/
-!function(factory) {
-    "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
-}(function($) {
-    return window.dependencyLib = $, $;
-});

+ 1 - 1
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 42 - 34
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery")) : factory(window.dependencyLib || jQuery);
@@ -282,29 +282,6 @@
             }
             return before !== -1 && closestTo - before > 1 || after < closestTo ? before : after;
         }
-        function setValidPosition(pos, validTest, fromSetValid, isSelection) {
-            if (isSelection || opts.insertMode && void 0 !== getMaskSet().validPositions[pos] && void 0 === fromSetValid) {
-                var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
-                for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
-                getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-                var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1;
-                for (i = j = pos; i <= lvp; i++) {
-                    var t = positionsClone[i];
-                    if (void 0 !== t) for (var posMatch = j; posMatch < getMaskSet().maskLength && (null == t.match.fn && vps[i] && (vps[i].match.optionalQuantifier === !0 || vps[i].match.optionality === !0) || null != t.match.fn); ) {
-                        if (posMatch++, positionCanMatchDefinition(posMatch, t.match.def)) {
-                            var result = isValid(posMatch, t.input, !0, !0);
-                            valid = result !== !1, j = result.caret || result.insert ? getLastValidPosition() : posMatch, 
-                            needsValidation = !0;
-                        } else valid = t.generatedInput === !0;
-                        if (valid) break;
-                    }
-                    if (!valid) break;
-                }
-                if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
-                resetMaskSet(!0), !1;
-            } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-            return resetMaskSet(!0), !0;
-        }
         function stripValidPositions(start, end, nocheck, strict) {
             function IsEnclosedStatic(pos) {
                 var posMatch = getMaskSet().validPositions[pos];
@@ -627,24 +604,55 @@
                     }), !0);
                 }
             }
+            function setValidPosition(pos, validTest, fromSetValid, isSelection) {
+                if (isSelection || opts.insertMode && void 0 !== getMaskSet().validPositions[pos] && void 0 === fromSetValid) {
+                    var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
+                    for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
+                    getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
+                    var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1, initialLength = getMaskSet().maskLength;
+                    for (i = j = pos; i <= lvp; i++) {
+                        var t = positionsClone[i];
+                        if (void 0 !== t) for (var posMatch = j; posMatch < getMaskSet().maskLength && (null == t.match.fn && vps[i] && (vps[i].match.optionalQuantifier === !0 || vps[i].match.optionality === !0) || null != t.match.fn); ) {
+                            if (posMatch++, needsValidation === !1 && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 
+                            getMaskSet().validPositions[posMatch].input = t.input, fillMissingNonMask(posMatch), 
+                            j = posMatch, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
+                                var result = isValid(posMatch, t.input, !0, !0);
+                                valid = result !== !1, j = result.caret || result.insert ? getLastValidPosition() : posMatch, 
+                                needsValidation = !0;
+                            } else valid = t.generatedInput === !0;
+                            if (getMaskSet().maskLength < initialLength && (getMaskSet().maskLength = initialLength), 
+                            valid) break;
+                        }
+                        if (!valid) break;
+                    }
+                    if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
+                    resetMaskSet(!0), !1;
+                } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
+                return resetMaskSet(!0), !0;
+            }
+            function fillMissingNonMask(maskPos) {
+                for (var pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
+                var testTemplate, testsFromPos;
+                for (pndx++; pndx < maskPos; pndx++) void 0 === getMaskSet().validPositions[pndx] && (opts.jitMasking === !1 || opts.jitMasking > pndx) && (testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice(), 
+                "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop(), testTemplate = determineTestTemplate(testsFromPos), 
+                testTemplate && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && (result = _isValid(pndx, testTemplate.match.placeholder || (null == testTemplate.match.fn ? testTemplate.match.def : "" !== getPlaceholder(pndx) ? getPlaceholder(pndx) : getBuffer()[pndx]), !0), 
+                result !== !1 && (getMaskSet().validPositions[result.pos || pndx].generatedInput = !0)));
+            }
             strict = strict === !0;
             var maskPos = pos;
             void 0 !== pos.begin && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin);
-            for (var result = !1, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
-            var testTemplate, testsFromPos;
-            for (pndx++; pndx < maskPos; pndx++) void 0 === getMaskSet().validPositions[pndx] && (opts.jitMasking === !1 || opts.jitMasking > pndx) && (testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice(), 
-            "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop(), testTemplate = determineTestTemplate(testsFromPos), 
-            testTemplate && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && (result = _isValid(pndx, testTemplate.match.placeholder || (null == testTemplate.match.fn ? testTemplate.match.def : "" !== getPlaceholder(pndx) ? getPlaceholder(pndx) : getBuffer()[pndx]), !0), 
-            result !== !1 && (getMaskSet().validPositions[result.pos || pndx].generatedInput = !0)));
-            if (isSelection(pos) && (handleRemove(void 0, Inputmask.keyCode.DELETE, pos), maskPos = getMaskSet().p), 
-            maskPos < getMaskSet().maskLength && (result = _isValid(maskPos, c, strict), (!strict || fromSetValid === !0) && result === !1)) {
+            var result = !1, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
+            if (fillMissingNonMask(maskPos), isSelection(pos) && (handleRemove(void 0, Inputmask.keyCode.DELETE, pos), 
+            maskPos = getMaskSet().p), maskPos < getMaskSet().maskLength && (result = _isValid(maskPos, c, strict), 
+            (!strict || fromSetValid === !0) && result === !1)) {
                 var currentPosValid = getMaskSet().validPositions[maskPos];
                 if (!currentPosValid || null !== currentPosValid.match.fn || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) {
                     if ((opts.insertMode || void 0 === getMaskSet().validPositions[seekNext(maskPos)]) && !isMask(maskPos, !0)) {
-                        testsFromPos = getTests(maskPos).slice(), "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop();
+                        var testsFromPos = getTests(maskPos).slice();
+                        "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop();
                         var staticChar = determineTestTemplate(testsFromPos, !0);
                         staticChar && (staticChar = staticChar.match.placeholder || staticChar.match.def, 
-                        _isValid(maskPos, staticChar, strict));
+                        _isValid(maskPos, staticChar, strict), getMaskSet().validPositions[maskPos].generatedInput = !0);
                         for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (result = _isValid(nPos, c, strict), 
                         result !== !1) {
                             trackbackAlternations(maskPos, nPos), maskPos = nPos;

+ 8 - 5
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
@@ -30,10 +30,13 @@
                 opts.numericInput === !0 && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 
                 opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts.decimalProtect = !1);
                 var mask = autoEscape(opts.prefix);
-                return mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}", 
-                void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.decimalProtect && (opts.radixPointDefinitionSymbol = ":"), 
-                mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"), 
-                mask += "[-]", mask += autoEscape(opts.suffix), opts.greedy = !1, null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
+                if (mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}", 
+                void 0 !== opts.digits) {
+                    opts.decimalProtect && (opts.radixPointDefinitionSymbol = ":");
+                    var dq = opts.digits.split(",");
+                    isFinite(dq[0] && isFinite(dq[1])) ? mask += (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}" : (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}");
+                }
+                return mask += "[-]", mask += autoEscape(opts.suffix), opts.greedy = !1, null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
                 "," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, "."))), 
                 null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
                 "," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, "."))), 

+ 1 - 1
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/inputmask.regex.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery, window.Inputmask);

+ 49 - 38
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 !function($) {
     function Inputmask(alias, options) {
@@ -280,29 +280,6 @@
             }
             return before !== -1 && closestTo - before > 1 || after < closestTo ? before : after;
         }
-        function setValidPosition(pos, validTest, fromSetValid, isSelection) {
-            if (isSelection || opts.insertMode && void 0 !== getMaskSet().validPositions[pos] && void 0 === fromSetValid) {
-                var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
-                for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
-                getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-                var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1;
-                for (i = j = pos; i <= lvp; i++) {
-                    var t = positionsClone[i];
-                    if (void 0 !== t) for (var posMatch = j; posMatch < getMaskSet().maskLength && (null == t.match.fn && vps[i] && (vps[i].match.optionalQuantifier === !0 || vps[i].match.optionality === !0) || null != t.match.fn); ) {
-                        if (posMatch++, positionCanMatchDefinition(posMatch, t.match.def)) {
-                            var result = isValid(posMatch, t.input, !0, !0);
-                            valid = result !== !1, j = result.caret || result.insert ? getLastValidPosition() : posMatch, 
-                            needsValidation = !0;
-                        } else valid = t.generatedInput === !0;
-                        if (valid) break;
-                    }
-                    if (!valid) break;
-                }
-                if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
-                resetMaskSet(!0), !1;
-            } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-            return resetMaskSet(!0), !0;
-        }
         function stripValidPositions(start, end, nocheck, strict) {
             function IsEnclosedStatic(pos) {
                 var posMatch = getMaskSet().validPositions[pos];
@@ -625,24 +602,55 @@
                     }), !0);
                 }
             }
+            function setValidPosition(pos, validTest, fromSetValid, isSelection) {
+                if (isSelection || opts.insertMode && void 0 !== getMaskSet().validPositions[pos] && void 0 === fromSetValid) {
+                    var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
+                    for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
+                    getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
+                    var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1, initialLength = getMaskSet().maskLength;
+                    for (i = j = pos; i <= lvp; i++) {
+                        var t = positionsClone[i];
+                        if (void 0 !== t) for (var posMatch = j; posMatch < getMaskSet().maskLength && (null == t.match.fn && vps[i] && (vps[i].match.optionalQuantifier === !0 || vps[i].match.optionality === !0) || null != t.match.fn); ) {
+                            if (posMatch++, needsValidation === !1 && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 
+                            getMaskSet().validPositions[posMatch].input = t.input, fillMissingNonMask(posMatch), 
+                            j = posMatch, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
+                                var result = isValid(posMatch, t.input, !0, !0);
+                                valid = result !== !1, j = result.caret || result.insert ? getLastValidPosition() : posMatch, 
+                                needsValidation = !0;
+                            } else valid = t.generatedInput === !0;
+                            if (getMaskSet().maskLength < initialLength && (getMaskSet().maskLength = initialLength), 
+                            valid) break;
+                        }
+                        if (!valid) break;
+                    }
+                    if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
+                    resetMaskSet(!0), !1;
+                } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
+                return resetMaskSet(!0), !0;
+            }
+            function fillMissingNonMask(maskPos) {
+                for (var pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
+                var testTemplate, testsFromPos;
+                for (pndx++; pndx < maskPos; pndx++) void 0 === getMaskSet().validPositions[pndx] && (opts.jitMasking === !1 || opts.jitMasking > pndx) && (testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice(), 
+                "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop(), testTemplate = determineTestTemplate(testsFromPos), 
+                testTemplate && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && (result = _isValid(pndx, testTemplate.match.placeholder || (null == testTemplate.match.fn ? testTemplate.match.def : "" !== getPlaceholder(pndx) ? getPlaceholder(pndx) : getBuffer()[pndx]), !0), 
+                result !== !1 && (getMaskSet().validPositions[result.pos || pndx].generatedInput = !0)));
+            }
             strict = strict === !0;
             var maskPos = pos;
             void 0 !== pos.begin && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin);
-            for (var result = !1, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
-            var testTemplate, testsFromPos;
-            for (pndx++; pndx < maskPos; pndx++) void 0 === getMaskSet().validPositions[pndx] && (opts.jitMasking === !1 || opts.jitMasking > pndx) && (testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice(), 
-            "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop(), testTemplate = determineTestTemplate(testsFromPos), 
-            testTemplate && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && (result = _isValid(pndx, testTemplate.match.placeholder || (null == testTemplate.match.fn ? testTemplate.match.def : "" !== getPlaceholder(pndx) ? getPlaceholder(pndx) : getBuffer()[pndx]), !0), 
-            result !== !1 && (getMaskSet().validPositions[result.pos || pndx].generatedInput = !0)));
-            if (isSelection(pos) && (handleRemove(void 0, Inputmask.keyCode.DELETE, pos), maskPos = getMaskSet().p), 
-            maskPos < getMaskSet().maskLength && (result = _isValid(maskPos, c, strict), (!strict || fromSetValid === !0) && result === !1)) {
+            var result = !1, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
+            if (fillMissingNonMask(maskPos), isSelection(pos) && (handleRemove(void 0, Inputmask.keyCode.DELETE, pos), 
+            maskPos = getMaskSet().p), maskPos < getMaskSet().maskLength && (result = _isValid(maskPos, c, strict), 
+            (!strict || fromSetValid === !0) && result === !1)) {
                 var currentPosValid = getMaskSet().validPositions[maskPos];
                 if (!currentPosValid || null !== currentPosValid.match.fn || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) {
                     if ((opts.insertMode || void 0 === getMaskSet().validPositions[seekNext(maskPos)]) && !isMask(maskPos, !0)) {
-                        testsFromPos = getTests(maskPos).slice(), "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop();
+                        var testsFromPos = getTests(maskPos).slice();
+                        "" === testsFromPos[testsFromPos.length - 1].match.def && testsFromPos.pop();
                         var staticChar = determineTestTemplate(testsFromPos, !0);
                         staticChar && (staticChar = staticChar.match.placeholder || staticChar.match.def, 
-                        _isValid(maskPos, staticChar, strict));
+                        _isValid(maskPos, staticChar, strict), getMaskSet().validPositions[maskPos].generatedInput = !0);
                         for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) if (result = _isValid(nPos, c, strict), 
                         result !== !1) {
                             trackbackAlternations(maskPos, nPos), maskPos = nPos;
@@ -2134,10 +2142,13 @@
                 opts.numericInput === !0 && (opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 
                 opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts.decimalProtect = !1);
                 var mask = autoEscape(opts.prefix);
-                return mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}", 
-                void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.decimalProtect && (opts.radixPointDefinitionSymbol = ":"), 
-                mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"), 
-                mask += "[-]", mask += autoEscape(opts.suffix), opts.greedy = !1, null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
+                if (mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}", 
+                void 0 !== opts.digits) {
+                    opts.decimalProtect && (opts.radixPointDefinitionSymbol = ":");
+                    var dq = opts.digits.split(",");
+                    isFinite(dq[0] && isFinite(dq[1])) ? mask += (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}" : (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}");
+                }
+                return mask += "[-]", mask += autoEscape(opts.suffix), opts.greedy = !1, null !== opts.min && (opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
                 "," === opts.radixPoint && (opts.min = opts.min.replace(opts.radixPoint, "."))), 
                 null !== opts.max && (opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
                 "," === opts.radixPoint && (opts.max = opts.max.replace(opts.radixPoint, "."))), 

+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 /*
  Input Mask plugin extensions

+ 0 - 8
dist/min/inputmask/inputmask.dependencyLib.jquery.min.js

@@ -1,8 +0,0 @@
-/*!
-* inputmask.dependencyLib.jquery.min.js
-* https://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2016 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
-*/
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return window.dependencyLib=a,a});

+ 1 - 1
dist/min/inputmask/inputmask.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 /*
  Input Mask plugin extensions

File diff suppressed because it is too large
+ 91 - 88
dist/min/inputmask/inputmask.min.js


File diff suppressed because it is too large
+ 3 - 3
dist/min/inputmask/inputmask.numeric.extensions.min.js


+ 1 - 1
dist/min/inputmask/inputmask.phone.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 /*
  Input Mask plugin extensions

+ 1 - 1
dist/min/inputmask/inputmask.regex.extensions.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 /*
  Input Mask plugin extensions

+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.2-123
+* Version: 3.3.2
 */
 /*
  * Input Mask plugin for jquery

File diff suppressed because it is too large
+ 93 - 90
dist/min/jquery.inputmask.bundle.min.js


+ 80 - 72
js/inputmask.js

@@ -803,57 +803,6 @@
 			return (before !== -1 && (closestTo - before) > 1) || after < closestTo ? before : after;
 		}
 
-		function setValidPosition(pos, validTest, fromSetValid, isSelection) {
-			if (isSelection || (opts.insertMode && getMaskSet().validPositions[pos] !== undefined && fromSetValid === undefined)) {
-				//reposition & revalidate others
-				var positionsClone = $.extend(true, {}, getMaskSet().validPositions),
-					lvp = getLastValidPosition(),
-					i;
-				for (i = pos; i <= lvp; i++) { //clear selection
-					delete getMaskSet().validPositions[i];
-				}
-				getMaskSet().validPositions[pos] = $.extend(true, {}, validTest);
-				var valid = true,
-					j, vps = getMaskSet().validPositions, needsValidation = false;
-				for (i = (j = pos); i <= lvp; i++) {
-					var t = positionsClone[i];
-					if (t !== undefined) {
-						var posMatch = j;
-						while (posMatch < getMaskSet().maskLength && ((t.match.fn == null && vps[i] && (vps[i].match.optionalQuantifier === true || vps[i].match.optionality === true)) || t.match.fn != null)) {
-							posMatch++;
-							if (false && needsValidation === false && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) { //obvious match
-								getMaskSet().validPositions[posMatch] = $.extend(true, {}, positionsClone[posMatch]);
-								getMaskSet().validPositions[posMatch].input = t.input;
-								j = posMatch;
-								valid = true;
-							} else if (positionCanMatchDefinition(posMatch, t.match.def)) { //validated match
-								var result = isValid(posMatch, t.input, true, true);
-								valid = result !== false;
-								j = (result.caret || result.insert) ? getLastValidPosition() : posMatch;
-								needsValidation = true;
-							} else {
-								valid = t.generatedInput === true;
-							}
-							if (valid) break;
-						}
-					}
-					if (!valid) break;
-				}
-
-				if (!valid) {
-					getMaskSet().validPositions = $.extend(true, {}, positionsClone);
-					resetMaskSet(true);
-					return false;
-				}
-			}
-
-			else
-				getMaskSet().validPositions[pos] = $.extend(true, {}, validTest);
-			;
-
-			resetMaskSet(true);
-			return true;
-		}
 
 		function stripValidPositions(start, end, nocheck, strict) {
 			function IsEnclosedStatic(pos) {
@@ -1535,7 +1484,7 @@
 				return isValidRslt;
 			}
 
-//set alternator choice on previous skipped placeholder positions
+			//set alternator choice on previous skipped placeholder positions
 			function trackbackAlternations(originalPos, newPos) {
 				var vp = getMaskSet().validPositions[newPos],
 					targetLocator = vp.locator,
@@ -1563,31 +1512,89 @@
 				}
 			}
 
-			var result = false,
-				positionsClone = $.extend(true, {}, getMaskSet().validPositions); //clone the currentPositions
+			function setValidPosition(pos, validTest, fromSetValid, isSelection) {
+				if (isSelection || (opts.insertMode && getMaskSet().validPositions[pos] !== undefined && fromSetValid === undefined)) {
+					//reposition & revalidate others
+					var positionsClone = $.extend(true, {}, getMaskSet().validPositions),
+						lvp = getLastValidPosition(),
+						i;
+					for (i = pos; i <= lvp; i++) { //clear selection
+						delete getMaskSet().validPositions[i];
+					}
+					getMaskSet().validPositions[pos] = $.extend(true, {}, validTest);
+					var valid = true,
+						j, vps = getMaskSet().validPositions, needsValidation = false,
+						initialLength = getMaskSet().maskLength;
+					for (i = (j = pos); i <= lvp; i++) {
+						var t = positionsClone[i];
+						if (t !== undefined) {
+							var posMatch = j;
+							while (posMatch < getMaskSet().maskLength && ((t.match.fn == null && vps[i] && (vps[i].match.optionalQuantifier === true || vps[i].match.optionality === true)) || t.match.fn != null)) {
+								posMatch++;
+								if (needsValidation === false && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) { //obvious match
+									getMaskSet().validPositions[posMatch] = $.extend(true, {}, positionsClone[posMatch]);
+									getMaskSet().validPositions[posMatch].input = t.input;
+									fillMissingNonMask(posMatch);
+									j = posMatch;
+									valid = true;
+								} else if (positionCanMatchDefinition(posMatch, t.match.def)) { //validated match
+									var result = isValid(posMatch, t.input, true, true);
+									valid = result !== false;
+									j = (result.caret || result.insert) ? getLastValidPosition() : posMatch;
+									needsValidation = true;
+								} else {
+									valid = t.generatedInput === true;
+								}
+								if (getMaskSet().maskLength < initialLength) getMaskSet().maskLength = initialLength; //a bit hacky but the masklength is corrected later on
+								if (valid) break;
+							}
+						}
+						if (!valid) break;
+					}
+
+					if (!valid) {
+						getMaskSet().validPositions = $.extend(true, {}, positionsClone);
+						resetMaskSet(true);
+						return false;
+					}
+				}
+
+				else
+					getMaskSet().validPositions[pos] = $.extend(true, {}, validTest);
+				;
+
+				resetMaskSet(true);
+				return true;
+			}
 
-//Check for a nonmask before the pos
-//find previous valid
-			for (var pndx = maskPos - 1; pndx > -1; pndx--) {
-				if (getMaskSet().validPositions[pndx]) break;
-			}
-////fill missing nonmask and valid placeholders
-			var testTemplate, generatedPos, testsFromPos;
-			for (pndx++; pndx < maskPos; pndx++) {
-				if (getMaskSet().validPositions[pndx] === undefined && (opts.jitMasking === false || opts.jitMasking > pndx)) {
-					testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice();
-					if (testsFromPos[testsFromPos.length - 1].match.def === "") testsFromPos.pop();
-					testTemplate = determineTestTemplate(testsFromPos);
-					if (testTemplate && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, true) ||
-						($.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, false, opts)))) {
-						result = _isValid(pndx, testTemplate.match.placeholder || (testTemplate.match.fn == null ? testTemplate.match.def : (getPlaceholder(pndx) !== "" ? getPlaceholder(pndx) : getBuffer()[pndx])), true);
-						if (result !== false) {
-							getMaskSet().validPositions[result.pos || pndx].generatedInput = true;
+			function fillMissingNonMask(maskPos) {
+				//Check for a nonmask before the pos
+				//find previous valid
+				for (var pndx = maskPos - 1; pndx > -1; pndx--) {
+					if (getMaskSet().validPositions[pndx]) break;
+				}
+				////fill missing nonmask and valid placeholders
+				var testTemplate, testsFromPos;
+				for (pndx++; pndx < maskPos; pndx++) {
+					if (getMaskSet().validPositions[pndx] === undefined && (opts.jitMasking === false || opts.jitMasking > pndx)) {
+						testsFromPos = getTests(pndx, getTestTemplate(pndx - 1).locator, pndx - 1).slice();
+						if (testsFromPos[testsFromPos.length - 1].match.def === "") testsFromPos.pop();
+						testTemplate = determineTestTemplate(testsFromPos);
+						if (testTemplate && (testTemplate.match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, true) ||
+							($.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, false, opts)))) {
+							result = _isValid(pndx, testTemplate.match.placeholder || (testTemplate.match.fn == null ? testTemplate.match.def : (getPlaceholder(pndx) !== "" ? getPlaceholder(pndx) : getBuffer()[pndx])), true);
+							if (result !== false) {
+								getMaskSet().validPositions[result.pos || pndx].generatedInput = true;
+							}
 						}
 					}
 				}
 			}
 
+			var result = false,
+				positionsClone = $.extend(true, {}, getMaskSet().validPositions); //clone the currentPositions
+
+			fillMissingNonMask(maskPos);
 
 			if (isSelection(pos)) {
 				handleRemove(undefined, Inputmask.keyCode.DELETE, pos);
@@ -1603,12 +1610,13 @@
 							"caret": seekNext(maskPos)
 						};
 					} else if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && !isMask(maskPos, true)) { //does the input match on a further position?
-						testsFromPos = getTests(maskPos).slice();
+						var testsFromPos = getTests(maskPos).slice();
 						if (testsFromPos[testsFromPos.length - 1].match.def === "") testsFromPos.pop();
 						var staticChar = determineTestTemplate(testsFromPos, true);
 						if (staticChar) {
 							staticChar = staticChar.match.placeholder || staticChar.match.def;
 							_isValid(maskPos, staticChar, strict);
+							getMaskSet().validPositions[maskPos].generatedInput = true;
 						}
 						for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) {
 							result = _isValid(nPos, c, strict);

+ 1 - 2
js/inputmask.numeric.extensions.js

@@ -699,5 +699,4 @@
 	})
 	;
 	return Inputmask;
-}))
-;
+}));

+ 2 - 2
qunit/config.js

@@ -7,7 +7,7 @@ require.config({
 		"inputmask.dependencyLib": "../extra/dependencyLibs/inputmask.dependencyLib.jquery",
 		//"inputmask.dependencyLib": "../extra/dependencyLibs/inputmask.dependencyLib",
 		// "inputmask.dependencyLib": "../extra/dependencyLibs/inputmask.dependencyLib.jqlite",
-		//"inputmask": "../dist/inputmask/inputmask"
-		"inputmask": "../js/inputmask"
+		"inputmask": "../dist/inputmask/inputmask"
+		//"inputmask": "../js/inputmask"
 	}
 });

+ 1 - 1
qunit/qunit.html

@@ -2,7 +2,7 @@
 <html>
 <head>
   <meta charset="utf-8">
-  <title>jquery.inputmask - QUnit</title>
+  <title>Inputmask - QUnit</title>
   <link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
 </head>
 <body>

+ 1 - 1
qunit/qunit_phone.html

@@ -2,7 +2,7 @@
 <html>
 <head>
   <meta charset="utf-8">
-  <title>jquery.inputmask - QUnit</title>
+  <title>Inputmask - QUnit</title>
   <link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
 </head>
 <body>

+ 29 - 22
qunit/tests_phoneru.js

@@ -18,28 +18,35 @@ define([
 
 	qunit.module("Phoneru masks");
 
-	qunit.test("inputmask(\"phoneru\")", function (assert) {
-		var $fixture = $("#qunit-fixture");
-		$fixture.append('<input type="text" id="testmask" />');
-		var testmask = document.getElementById("testmask");
-		Inputmask("phoneru", {nullable: false}).mask(testmask);
 
-		testmask.focus();
+	for (var i = 0; i < Inputmask.prototype.defaults.aliases.phoneru.phoneCodes.length; i += 25) {
+		qunit.test("inputmask(\"phoneru\") - " + i + "-" + (i + 25), function (assert) {
+				var i = assert.test.testName.match(/\d+$/);
+				i = i - 25;
+				var $fixture = $("#qunit-fixture");
+				$fixture.append('<input type="text" id="testmask" />');
+				var testmask = document.getElementById("testmask");
+				Inputmask("phoneru", {nullable: false}).mask(testmask);
 
-		$.each(Inputmask.prototype.defaults.aliases.phoneru.phoneCodes.slice(0,25), function (ndx, lmnt) {
-			var ndx = 1, input, expected = lmnt.mask;
-			while (expected.match(/#/)) {
-				expected = expected.replace(/#/, ndx++);
-				if (ndx > 9) ndx = 1;
-			}
-			input = expected;
-			//input = input.replace(/\+/g, "");
-			input = input.replace(/\(/g, "");
-			input = input.replace(/\)/g, "");
-			input = input.replace(/-/g, "");
+				testmask.focus();
+
+				$.each(Inputmask.prototype.defaults.aliases.phoneru.phoneCodes.slice(i, i + 25), function (ndx, lmnt) {
+					var ndx = 1, input, expected = lmnt.mask;
+					while (expected.match(/#/)) {
+						expected = expected.replace(/#/, ndx++);
+						if (ndx > 9) ndx = 1;
+					}
+					input = expected;
+					//input = input.replace(/\+/g, "");
+					input = input.replace(/\(/g, "");
+					input = input.replace(/\)/g, "");
+					input = input.replace(/-/g, "");
 
-			$(testmask).val(input);
-			assert.equal(testmask.value, expected, "Result " + testmask.value);
-		});
-	});
-});
+					$(testmask).val(input);
+					assert.equal(testmask.value, expected, "Result " + testmask.value);
+				});
+			}
+		)
+	}
+})
+;