ソースを参照

jquery.inputmask 3.1.35

Robin Herbots 11 年 前
コミット
c480f5d9c4

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.1.34",
+  "version": "3.1.35",
   "main": [
     "./dist/inputmask/jquery.inputmask.js",
     "./dist/inputmask/jquery.inputmask.extensions.js",

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

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

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

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

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.34
+* Version: 3.1.35
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory(jQuery);
@@ -261,15 +261,8 @@
             resetMaskSet(!0);
         }
         function getTestTemplate(pos, ndxIntlzr, tstPs) {
-            function checkAlternationMatch(test, altNdx, altArr) {
-                for (var altArrC = opts.greedy ? altArr : altArr.slice(0, 1), isMatch = !1, altLocArr = test.locator[altNdx].toString().split(","), alndx = 0; alndx < altLocArr.length; alndx++) if (-1 != $.inArray(altLocArr[alndx], altArrC)) {
-                    isMatch = !0;
-                    break;
-                }
-                return isMatch;
-            }
             for (var testPos, testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], 
-            !(opts.greedy || testPos.match && (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0 && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos, lvTest.alternation, lvTestAltArr)))); ndx++) ;
+            !(opts.greedy || testPos.match && (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0 && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
             return testPos;
         }
         function getTest(pos) {
@@ -407,6 +400,13 @@
             }
             return elem;
         }
+        function checkAlternationMatch(altArr1, altArr2) {
+            for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 != $.inArray(altArr1[alndx], altArrC)) {
+                isMatch = !0;
+                break;
+            }
+            return isMatch;
+        }
         function isValid(pos, c, strict, fromSetValid) {
             function _isValid(position, c, strict, fromSetValid) {
                 var rslt = !1;
@@ -467,8 +467,8 @@
             }
             function trackbackAlternations(originalPos, newPos) {
                 for (var vp = getMaskSet().validPositions[newPos], targetLocator = vp.locator, tll = targetLocator.length, ps = originalPos; newPos > ps; ps++) if (!isMask(ps)) {
-                    var bestMatch, tests = getTests(ps), equality = -1;
-                    for (var tndx in tests) for (var activeTest = tests[tndx], i = 0; tll > i; i++) targetLocator[i] == activeTest.locator[i] && i > equality && (equality = i, 
+                    var tests = getTests(ps), bestMatch = tests[0], equality = -1;
+                    for (var tndx in tests) for (var activeTest = tests[tndx], i = 0; tll > i; i++) activeTest.locator[i] && checkAlternationMatch(activeTest.locator[i].toString().split(","), targetLocator[i].toString().split(",")) && i > equality && (equality = i, 
                     bestMatch = activeTest);
                     setValidPosition(ps, $.extend({}, bestMatch, {
                         input: bestMatch.match.def
@@ -684,7 +684,7 @@
                     $input.trigger("setvalue"));
                 });
                 //!! the bound handlers are executed in the order they where bound
-                var events = $._data(npt).events, handlers = events.mouseover;
+                var events = $._data(npt).events, handlers = events.mouseenter;
                 if (handlers) {
                     for (var ourHandler = handlers[handlers.length - 1], i = handlers.length - 1; i > 0; i--) handlers[i] = handlers[i - 1];
                     handlers[0] = ourHandler;

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

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

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

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

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

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

+ 12 - 12
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.1.34
+* Version: 3.1.35
 */
 !function($) {
     function isInputEventSupported(eventName) {
@@ -259,15 +259,8 @@
             resetMaskSet(!0);
         }
         function getTestTemplate(pos, ndxIntlzr, tstPs) {
-            function checkAlternationMatch(test, altNdx, altArr) {
-                for (var altArrC = opts.greedy ? altArr : altArr.slice(0, 1), isMatch = !1, altLocArr = test.locator[altNdx].toString().split(","), alndx = 0; alndx < altLocArr.length; alndx++) if (-1 != $.inArray(altLocArr[alndx], altArrC)) {
-                    isMatch = !0;
-                    break;
-                }
-                return isMatch;
-            }
             for (var testPos, testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], 
-            !(opts.greedy || testPos.match && (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0 && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos, lvTest.alternation, lvTestAltArr)))); ndx++) ;
+            !(opts.greedy || testPos.match && (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0 && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
             return testPos;
         }
         function getTest(pos) {
@@ -405,6 +398,13 @@
             }
             return elem;
         }
+        function checkAlternationMatch(altArr1, altArr2) {
+            for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 != $.inArray(altArr1[alndx], altArrC)) {
+                isMatch = !0;
+                break;
+            }
+            return isMatch;
+        }
         function isValid(pos, c, strict, fromSetValid) {
             function _isValid(position, c, strict, fromSetValid) {
                 var rslt = !1;
@@ -465,8 +465,8 @@
             }
             function trackbackAlternations(originalPos, newPos) {
                 for (var vp = getMaskSet().validPositions[newPos], targetLocator = vp.locator, tll = targetLocator.length, ps = originalPos; newPos > ps; ps++) if (!isMask(ps)) {
-                    var bestMatch, tests = getTests(ps), equality = -1;
-                    for (var tndx in tests) for (var activeTest = tests[tndx], i = 0; tll > i; i++) targetLocator[i] == activeTest.locator[i] && i > equality && (equality = i, 
+                    var tests = getTests(ps), bestMatch = tests[0], equality = -1;
+                    for (var tndx in tests) for (var activeTest = tests[tndx], i = 0; tll > i; i++) activeTest.locator[i] && checkAlternationMatch(activeTest.locator[i].toString().split(","), targetLocator[i].toString().split(",")) && i > equality && (equality = i, 
                     bestMatch = activeTest);
                     setValidPosition(ps, $.extend({}, bestMatch, {
                         input: bestMatch.match.def
@@ -682,7 +682,7 @@
                     $input.trigger("setvalue"));
                 });
                 //!! the bound handlers are executed in the order they where bound
-                var events = $._data(npt).events, handlers = events.mouseover;
+                var events = $._data(npt).events, handlers = events.mouseenter;
                 if (handlers) {
                     for (var ourHandler = handlers[handlers.length - 1], i = handlers.length - 1; i > 0; i--) handlers[i] = handlers[i - 1];
                     handlers[0] = ourHandler;

ファイルの差分が大きいため隠しています
+ 4 - 4
dist/jquery.inputmask.bundle.min.js


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"mask"
     ],
-    "version": "3.1.34",
+    "version": "3.1.35",
     "author": {
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 18 - 25
js/jquery.inputmask.js

@@ -315,7 +315,7 @@
             androidfirefox = ua.match(new RegExp("android.*firefox.*", "i")) !== null,
             kindle = /Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua),
             PasteEventType = isInputEventSupported('paste') ? 'paste' : isInputEventSupported('input') ? 'input' : "propertychange";
-			
+
         //if (androidchrome) {
         //    var browser = navigator.userAgent.match(new RegExp("chrome.*", "i")),
         //        version = parseInt(new RegExp(/[0-9]+/).exec(browser));
@@ -454,17 +454,6 @@
                 resetMaskSet(true);
             }
             function getTestTemplate(pos, ndxIntlzr, tstPs) {
-                function checkAlternationMatch(test, altNdx, altArr) {
-                    var altArrC = opts.greedy ? altArr : altArr.slice(0, 1);
-                    var isMatch = false, altLocArr = test.locator[altNdx].toString().split(",");
-                    for (var alndx = 0; alndx < altLocArr.length; alndx++) {
-                        if ($.inArray(altLocArr[alndx], altArrC) != -1) {
-                            isMatch = true;
-                            break;
-                        }
-                    }
-                    return isMatch;
-                }
                 var testPositions = getTests(pos, ndxIntlzr, tstPs),
                     testPos,
                     lvp = getLastValidPosition(),
@@ -476,7 +465,7 @@
                     if (opts.greedy ||
                         ((testPos["match"] && (testPos["match"].optionality === false || testPos["match"].newBlockMarker === false) && testPos["match"].optionalQuantifier !== true) &&
                         (lvTest.alternation == undefined ||
-                        (testPos["locator"][lvTest.alternation] != undefined && checkAlternationMatch(testPos, lvTest.alternation, lvTestAltArr))))) {
+                        (testPos["locator"][lvTest.alternation] != undefined && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr))))) {
                         break;
                     }
                 }
@@ -711,6 +700,17 @@
 
                 return elem;
             }
+            function checkAlternationMatch(altArr1, altArr2) {
+                var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1),
+                    isMatch = false;
+                for (var alndx = 0; alndx < altArr1.length; alndx++) {
+                    if ($.inArray(altArr1[alndx], altArrC) != -1) {
+                        isMatch = true;
+                        break;
+                    }
+                }
+                return isMatch;
+            }
             function isValid(pos, c, strict, fromSetValid) { //strict true ~ no correction or autofill
                 strict = strict === true; //always set a value to strict to prevent possible strange behavior in the extensions 
 
@@ -843,26 +843,19 @@
                 }
                 //set alternator choice on previous skipped placeholder positions
                 function trackbackAlternations(originalPos, newPos) {
-                    //for (var alndx = 0; alndx < altLocArr.length; alndx++) {
-                    //    if ($.inArray(altLocArr[alndx], altArrC) != -1) {
-                    //        isMatch = true;
-                    //        break;
-                    //    }
-                    //}
-
                     var vp = getMaskSet()["validPositions"][newPos],
-                        targetLocator = vp.locator,
-                        tll = targetLocator.length;
+                         targetLocator = vp.locator,
+                         tll = targetLocator.length;
 
                     //console.log("target locator: " + targetLocator);
                     for (var ps = originalPos; ps < newPos; ps++) {
                         if (!isMask(ps)) {
                             var tests = getTests(ps),
-                            bestMatch, equality = -1;
+                            bestMatch = tests[0], equality = -1;
                             for (var tndx in tests) {
                                 var activeTest = tests[tndx];
                                 for (var i = 0; i < tll; i++) {
-                                    if (targetLocator[i] == activeTest.locator[i] && equality < i) { //needs fix for locators with multiple alternations
+                                    if (activeTest.locator[i] && checkAlternationMatch(activeTest.locator[i].toString().split(','), targetLocator[i].toString().split(',')) && equality < i) { //needs fix for locators with multiple alternations
                                         equality = i;
                                         bestMatch = activeTest;
                                     }
@@ -1209,7 +1202,7 @@
                     //!! the bound handlers are executed in the order they where bound
                     //reorder the events
                     var events = $._data(npt).events;
-                    var handlers = events["mouseover"];
+                    var handlers = events["mouseenter"];
                     if (handlers) {
                         var ourHandler = handlers[handlers.length - 1];
                         for (var i = handlers.length - 1; i > 0; i--) {