浏览代码

Inject some steroids

Robin Herbots 10 年之前
父节点
当前提交
caafb3fe01

+ 1 - 0
CHANGELOG.md

@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
 - include textarea as a valid masking element
 - include textarea as a valid masking element
 
 
 ### Updates
 ### Updates
+- enable simple caching in the getTests fn
 - implement missing parts in the jqlite DependencyLib
 - implement missing parts in the jqlite DependencyLib
 - Remove namespaces for events (simplifies implementing other dependencyLibs, besides jquery)
 - Remove namespaces for events (simplifies implementing other dependencyLibs, besides jquery)
 - update alternation logic
 - update alternation logic

+ 4 - 0
README.md

@@ -970,6 +970,10 @@ Inputmask("(99 99 999999)|(i{+})", {
 }).mask(selector);
 }).mask(selector);
 ```
 ```
 
 
+### disableCache
+Disabling caching for the getTests engine.  Should only be used for debugging purposes.
+Default: false
+
 ## General
 ## General
 ### set a value and apply mask
 ### set a value and apply mask
 this can be done with the traditional jquery.val function (all browsers) or JavaScript value property for browsers which implement lookupGetter or getOwnPropertyDescriptor
 this can be done with the traditional jquery.val function (all browsers) or JavaScript value property for browsers which implement lookupGetter or getOwnPropertyDescriptor

+ 1 - 1
bower.json

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

+ 1 - 1
component.json

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

+ 1 - 1
composer.json

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

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-30
+* Version: 3.2.6-31
 */
 */
 !function(factory) {
 !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);
     "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.dependencyLib.jquery.js

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

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-30
+* Version: 3.2.6-31
 */
 */
 !function(factory) {
 !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);
     "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);

+ 9 - 8
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-30
+* Version: 3.2.6-31
 */
 */
 !function(factory) {
 !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);
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery")) : factory(window.dependencyLib || jQuery);
@@ -322,7 +322,7 @@
         }
         }
         function getTestTemplate(pos, ndxIntlzr, tstPs) {
         function getTestTemplate(pos, ndxIntlzr, tstPs) {
             var testPos = getMaskSet().validPositions[pos];
             var testPos = getMaskSet().validPositions[pos];
-            if (void 0 === testPos) for (var testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], 
+            if (void 0 === testPos) for (var testPositions = getTests(pos, ndxIntlzr, tstPs, !0), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], 
             !(testPos.match && (opts.greedy && testPos.match.optionalQuantifier !== !0 || (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0) && (void 0 === lvTest.alternation || lvTest.alternation !== testPos.alternation || void 0 !== testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
             !(testPos.match && (opts.greedy && testPos.match.optionalQuantifier !== !0 || (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0) && (void 0 === lvTest.alternation || lvTest.alternation !== testPos.alternation || void 0 !== testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
             return testPos;
             return testPos;
         }
         }
@@ -330,7 +330,7 @@
             return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
             return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
         }
         }
         function positionCanMatchDefinition(pos, def) {
         function positionCanMatchDefinition(pos, def) {
-            for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
+            for (var valid = !1, tests = getTests(pos, void 0, void 0, !0), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
                 valid = !0;
                 valid = !0;
                 break;
                 break;
             }
             }
@@ -344,7 +344,7 @@
                 indexPos = ndxPos);
                 indexPos = ndxPos);
             }), bestMatch;
             }), bestMatch;
         }
         }
-        function getTests(pos, ndxIntlzr, tstPs, cacheable) {
+        function getTests(pos, ndxIntlzr, tstPs, validateCache) {
             function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
             function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
                 function handleMatch(match, loopNdx, quantifierRecurse) {
                 function handleMatch(match, loopNdx, quantifierRecurse) {
                     function isFirstMatch(latestMatch, tokenGroup) {
                     function isFirstMatch(latestMatch, tokenGroup) {
@@ -440,7 +440,7 @@
             }
             }
             var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
             var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
             if (pos > -1) {
             if (pos > -1) {
-                if (cacheable === !0 && getMaskSet().tests[pos]) return getMaskSet().tests[pos];
+                if (opts.disableCache !== !0 && validateCache !== !0 && getMaskSet().tests[pos]) return getMaskSet().tests[pos];
                 if (void 0 === ndxIntlzr) {
                 if (void 0 === ndxIntlzr) {
                     for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos]) && previousPos > -1 && (!getMaskSet().tests[previousPos] || void 0 === (test = getMaskSet().tests[previousPos][0])); ) previousPos--;
                     for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos]) && previousPos > -1 && (!getMaskSet().tests[previousPos] || void 0 === (test = getMaskSet().tests[previousPos][0])); ) previousPos--;
                     void 0 !== test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test.locator.slice());
                     void 0 !== test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test.locator.slice());
@@ -640,7 +640,7 @@
             if (strict ? (test = getTestTemplate(pos).match, "" == test.def && (test = getTest(pos))) : test = getTest(pos), 
             if (strict ? (test = getTestTemplate(pos).match, "" == test.def && (test = getTest(pos))) : test = getTest(pos), 
             null != test.fn) return test.fn;
             null != test.fn) return test.fn;
             if (strict !== !0 && pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
             if (strict !== !0 && pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
-                var tests = getTests(pos, void 0, void 0, !0);
+                var tests = getTests(pos);
                 return tests.length > 2;
                 return tests.length > 2;
             }
             }
             return !1;
             return !1;
@@ -685,7 +685,7 @@
             triggerInputEvent === !0 && (skipInputEvent = !0, $(input).trigger("input"));
             triggerInputEvent === !0 && (skipInputEvent = !0, $(input).trigger("input"));
         }
         }
         function getPlaceholder(pos, test) {
         function getPlaceholder(pos, test) {
-            if (test = test || getTest(pos), void 0 !== test.placeholder) return test.placeholder;
+            if (test = test || getTest(pos, void 0, void 0, !0), void 0 !== test.placeholder) return test.placeholder;
             if (null === test.fn) {
             if (null === test.fn) {
                 if (pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
                 if (pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
                     var prevTest, tests = getTests(pos), staticAlternations = 0;
                     var prevTest, tests = getTests(pos), staticAlternations = 0;
@@ -1325,7 +1325,8 @@
             canClearPosition: $.noop,
             canClearPosition: $.noop,
             postValidation: null,
             postValidation: null,
             staticDefinitionSymbol: void 0,
             staticDefinitionSymbol: void 0,
-            jitMasking: !1
+            jitMasking: !1,
+            disableCache: !1
         },
         },
         masksCache: {},
         masksCache: {},
         mask: function(elems) {
         mask: function(elems) {

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-30
+* Version: 3.2.6-31
 */
 */
 !function(factory) {
 !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);
     "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.phone.extensions.js

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

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

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

+ 9 - 8
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-30
+* Version: 3.2.6-31
 */
 */
 !function($) {
 !function($) {
     function Inputmask(alias, options) {
     function Inputmask(alias, options) {
@@ -320,7 +320,7 @@
         }
         }
         function getTestTemplate(pos, ndxIntlzr, tstPs) {
         function getTestTemplate(pos, ndxIntlzr, tstPs) {
             var testPos = getMaskSet().validPositions[pos];
             var testPos = getMaskSet().validPositions[pos];
-            if (void 0 === testPos) for (var testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], 
+            if (void 0 === testPos) for (var testPositions = getTests(pos, ndxIntlzr, tstPs, !0), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], 
             !(testPos.match && (opts.greedy && testPos.match.optionalQuantifier !== !0 || (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0) && (void 0 === lvTest.alternation || lvTest.alternation !== testPos.alternation || void 0 !== testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
             !(testPos.match && (opts.greedy && testPos.match.optionalQuantifier !== !0 || (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0) && (void 0 === lvTest.alternation || lvTest.alternation !== testPos.alternation || void 0 !== testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
             return testPos;
             return testPos;
         }
         }
@@ -328,7 +328,7 @@
             return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
             return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
         }
         }
         function positionCanMatchDefinition(pos, def) {
         function positionCanMatchDefinition(pos, def) {
-            for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
+            for (var valid = !1, tests = getTests(pos, void 0, void 0, !0), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
                 valid = !0;
                 valid = !0;
                 break;
                 break;
             }
             }
@@ -342,7 +342,7 @@
                 indexPos = ndxPos);
                 indexPos = ndxPos);
             }), bestMatch;
             }), bestMatch;
         }
         }
-        function getTests(pos, ndxIntlzr, tstPs, cacheable) {
+        function getTests(pos, ndxIntlzr, tstPs, validateCache) {
             function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
             function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
                 function handleMatch(match, loopNdx, quantifierRecurse) {
                 function handleMatch(match, loopNdx, quantifierRecurse) {
                     function isFirstMatch(latestMatch, tokenGroup) {
                     function isFirstMatch(latestMatch, tokenGroup) {
@@ -438,7 +438,7 @@
             }
             }
             var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
             var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
             if (pos > -1) {
             if (pos > -1) {
-                if (cacheable === !0 && getMaskSet().tests[pos]) return getMaskSet().tests[pos];
+                if (opts.disableCache !== !0 && validateCache !== !0 && getMaskSet().tests[pos]) return getMaskSet().tests[pos];
                 if (void 0 === ndxIntlzr) {
                 if (void 0 === ndxIntlzr) {
                     for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos]) && previousPos > -1 && (!getMaskSet().tests[previousPos] || void 0 === (test = getMaskSet().tests[previousPos][0])); ) previousPos--;
                     for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos]) && previousPos > -1 && (!getMaskSet().tests[previousPos] || void 0 === (test = getMaskSet().tests[previousPos][0])); ) previousPos--;
                     void 0 !== test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test.locator.slice());
                     void 0 !== test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test.locator.slice());
@@ -638,7 +638,7 @@
             if (strict ? (test = getTestTemplate(pos).match, "" == test.def && (test = getTest(pos))) : test = getTest(pos), 
             if (strict ? (test = getTestTemplate(pos).match, "" == test.def && (test = getTest(pos))) : test = getTest(pos), 
             null != test.fn) return test.fn;
             null != test.fn) return test.fn;
             if (strict !== !0 && pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
             if (strict !== !0 && pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
-                var tests = getTests(pos, void 0, void 0, !0);
+                var tests = getTests(pos);
                 return tests.length > 2;
                 return tests.length > 2;
             }
             }
             return !1;
             return !1;
@@ -683,7 +683,7 @@
             triggerInputEvent === !0 && (skipInputEvent = !0, $(input).trigger("input"));
             triggerInputEvent === !0 && (skipInputEvent = !0, $(input).trigger("input"));
         }
         }
         function getPlaceholder(pos, test) {
         function getPlaceholder(pos, test) {
-            if (test = test || getTest(pos), void 0 !== test.placeholder) return test.placeholder;
+            if (test = test || getTest(pos, void 0, void 0, !0), void 0 !== test.placeholder) return test.placeholder;
             if (null === test.fn) {
             if (null === test.fn) {
                 if (pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
                 if (pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
                     var prevTest, tests = getTests(pos), staticAlternations = 0;
                     var prevTest, tests = getTests(pos), staticAlternations = 0;
@@ -1323,7 +1323,8 @@
             canClearPosition: $.noop,
             canClearPosition: $.noop,
             postValidation: null,
             postValidation: null,
             staticDefinitionSymbol: void 0,
             staticDefinitionSymbol: void 0,
-            jitMasking: !1
+            jitMasking: !1,
+            disableCache: !1
         },
         },
         masksCache: {},
         masksCache: {},
         mask: function(elems) {
         mask: function(elems) {

文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js


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

@@ -3,6 +3,6 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-30
+* Version: 3.2.6-31
 */
 */
 !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});
 !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 - 3
dist/min/inputmask/inputmask.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.numeric.extensions.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.phone.extensions.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.regex.extensions.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js


文件差异内容过多而无法显示
+ 4 - 4
dist/min/jquery.inputmask.bundle.min.js


+ 13 - 8
js/inputmask.js

@@ -117,7 +117,8 @@
 				canClearPosition: $.noop, //hook to alter the clear behavior in the stripValidPositions args => maskset, position, lastValidPosition, opts => return true|false
 				canClearPosition: $.noop, //hook to alter the clear behavior in the stripValidPositions args => maskset, position, lastValidPosition, opts => return true|false
 				postValidation: null, //hook to postValidate the result from isValid.	Usefull for validating the entry as a whole.	args => buffer, currentResult, opts => return true/false/refresh command
 				postValidation: null, //hook to postValidate the result from isValid.	Usefull for validating the entry as a whole.	args => buffer, currentResult, opts => return true/false/refresh command
 				staticDefinitionSymbol: undefined, //specify a definitionSymbol for static content, used to make matches for alternators
 				staticDefinitionSymbol: undefined, //specify a definitionSymbol for static content, used to make matches for alternators
-				jitMasking: false //just in time masking ~ only mask while typing, can n (number), true or false
+				jitMasking: false, //just in time masking ~ only mask while typing, can n (number), true or false
+				disableCache: false //testing purposes
 			},
 			},
 			masksCache: {},
 			masksCache: {},
 			mask: function(elems) {
 			mask: function(elems) {
@@ -916,7 +917,7 @@
 			function getTestTemplate(pos, ndxIntlzr, tstPs) {
 			function getTestTemplate(pos, ndxIntlzr, tstPs) {
 				var testPos = getMaskSet().validPositions[pos];
 				var testPos = getMaskSet().validPositions[pos];
 				if (testPos === undefined) {
 				if (testPos === undefined) {
-					var testPositions = getTests(pos, ndxIntlzr, tstPs),
+					var testPositions = getTests(pos, ndxIntlzr, tstPs, true),
 						lvp = getLastValidPosition(),
 						lvp = getLastValidPosition(),
 						lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0],
 						lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0],
 						lvTestAltArr = (lvTest.alternation !== undefined) ? lvTest.locator[lvTest.alternation].toString().split(",") : [];
 						lvTestAltArr = (lvTest.alternation !== undefined) ? lvTest.locator[lvTest.alternation].toString().split(",") : [];
@@ -944,7 +945,7 @@
 
 
 			function positionCanMatchDefinition(pos, def) {
 			function positionCanMatchDefinition(pos, def) {
 				var valid = false,
 				var valid = false,
-					tests = getTests(pos);
+					tests = getTests(pos, undefined, undefined, true);
 				for (var tndx = 0; tndx < tests.length; tndx++) {
 				for (var tndx = 0; tndx < tests.length; tndx++) {
 					if (tests[tndx].match && tests[tndx].match.def === def) {
 					if (tests[tndx].match && tests[tndx].match.def === def) {
 						valid = true;
 						valid = true;
@@ -968,7 +969,7 @@
 				return bestMatch;
 				return bestMatch;
 			}
 			}
 
 
-			function getTests(pos, ndxIntlzr, tstPs, cacheable) {
+			function getTests(pos, ndxIntlzr, tstPs, validateCache) {
 				var maskTokens = getMaskSet().maskToken,
 				var maskTokens = getMaskSet().maskToken,
 					testPos = ndxIntlzr ? tstPs : 0,
 					testPos = ndxIntlzr ? tstPs : 0,
 					ndxInitializer = ndxIntlzr || [0],
 					ndxInitializer = ndxIntlzr || [0],
@@ -1159,8 +1160,12 @@
 				}
 				}
 
 
 				if (pos > -1) {
 				if (pos > -1) {
-					if (cacheable === true && getMaskSet().tests[pos]) {
-						return getMaskSet().tests[pos];
+					if (opts.disableCache !== true) {
+						if (validateCache !== true && getMaskSet().tests[pos]) {
+							return getMaskSet().tests[pos];
+						} else {
+
+						}
 					}
 					}
 					if (ndxIntlzr === undefined) {
 					if (ndxIntlzr === undefined) {
 						var previousPos = pos - 1,
 						var previousPos = pos - 1,
@@ -1589,7 +1594,7 @@
 				if (test.fn != null) {
 				if (test.fn != null) {
 					return test.fn;
 					return test.fn;
 				} else if (strict !== true && pos > -1 && !opts.keepStatic && getMaskSet().validPositions[pos] === undefined) {
 				} else if (strict !== true && pos > -1 && !opts.keepStatic && getMaskSet().validPositions[pos] === undefined) {
-					var tests = getTests(pos, undefined, undefined, true);
+					var tests = getTests(pos);
 					return tests.length > 2;
 					return tests.length > 2;
 				}
 				}
 				return false;
 				return false;
@@ -1657,7 +1662,7 @@
 			}
 			}
 
 
 			function getPlaceholder(pos, test) {
 			function getPlaceholder(pos, test) {
-				test = test || getTest(pos);
+				test = test || getTest(pos, undefined, undefined, true);
 				if (test.placeholder !== undefined) {
 				if (test.placeholder !== undefined) {
 					return test.placeholder;
 					return test.placeholder;
 				} else if (test.fn === null) {
 				} else if (test.fn === null) {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "jquery.inputmask",
   "name": "jquery.inputmask",
-  "version": "3.2.6-30",
+  "version": "3.2.6-31",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "files": [
   "files": [