Browse Source

alternation case for regex

Robin Herbots 8 years ago
parent
commit
7f8012180f
51 changed files with 107 additions and 133 deletions
  1. 1 1
      CHANGELOG.md
  2. 1 1
      bower.json
  3. 1 1
      component.json
  4. 1 1
      composer.json
  5. 1 1
      dist/inputmask/bindings/inputmask.binding.js
  6. 1 5
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js
  7. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js
  8. 1 5
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.js
  9. 1 1
      dist/inputmask/global/document.js
  10. 1 1
      dist/inputmask/global/window.js
  11. 1 1
      dist/inputmask/inputmask.date.extensions.js
  12. 1 1
      dist/inputmask/inputmask.extensions.js
  13. 6 5
      dist/inputmask/inputmask.js
  14. 1 1
      dist/inputmask/inputmask.numeric.extensions.js
  15. 1 1
      dist/inputmask/inputmask.phone.extensions.js
  16. 1 1
      dist/inputmask/jquery.inputmask.js
  17. 1 1
      dist/inputmask/phone-codes/phone-be.js
  18. 1 1
      dist/inputmask/phone-codes/phone-ca.js
  19. 1 1
      dist/inputmask/phone-codes/phone-mx.js
  20. 1 1
      dist/inputmask/phone-codes/phone-nl.js
  21. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  22. 1 1
      dist/inputmask/phone-codes/phone-uk.js
  23. 1 1
      dist/inputmask/phone-codes/phone-us.js
  24. 1 1
      dist/inputmask/phone-codes/phone.js
  25. 6 5
      dist/jquery.inputmask.bundle.js
  26. 1 1
      dist/min/inputmask/bindings/inputmask.binding.min.js
  27. 2 2
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js
  28. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js
  29. 2 2
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js
  30. 1 1
      dist/min/inputmask/global/document.min.js
  31. 1 1
      dist/min/inputmask/global/window.min.js
  32. 1 1
      dist/min/inputmask/inputmask.date.extensions.min.js
  33. 1 1
      dist/min/inputmask/inputmask.extensions.min.js
  34. 2 2
      dist/min/inputmask/inputmask.min.js
  35. 1 1
      dist/min/inputmask/inputmask.numeric.extensions.min.js
  36. 1 1
      dist/min/inputmask/inputmask.phone.extensions.min.js
  37. 1 1
      dist/min/inputmask/jquery.inputmask.min.js
  38. 1 1
      dist/min/inputmask/phone-codes/phone-be.min.js
  39. 1 1
      dist/min/inputmask/phone-codes/phone-ca.min.js
  40. 1 1
      dist/min/inputmask/phone-codes/phone-mx.min.js
  41. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  42. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  43. 1 1
      dist/min/inputmask/phone-codes/phone-uk.min.js
  44. 1 1
      dist/min/inputmask/phone-codes/phone-us.min.js
  45. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  46. 2 2
      dist/min/jquery.inputmask.bundle.min.js
  47. 0 31
      js/dependencyLibs/inputmask.dependencyLib.jqlite.js
  48. 0 31
      js/dependencyLibs/inputmask.dependencyLib.js
  49. 5 4
      js/inputmask.js
  50. 1 1
      package.json
  51. 41 0
      qunit/tests_alternations.js

+ 1 - 1
CHANGELOG.md

@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
 ## [UNRELEASED - 4.x]
 ### added
 - add support for input type search
-- new datetime alias (WIP)
+- new datetime alias
 
 ### Updates
 - better caret handling in colormask

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.0-76",
+  "version": "4.0.0-77",
   "main": [
 	  "./dist/inputmask/inputmask.js",
 	  "./dist/inputmask/inputmask.extensions.js",

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
 	"name": "inputmask",
 	"repository": "robinherbots/Inputmask",
 	"description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-	"version": "4.0.0-76",
+	"version": "4.0.0-77",
 	"keywords": [
 		"jquery",
 		"plugins",

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/inputmask",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-  "version": "4.0.0-76",
+  "version": "4.0.0-77",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 1 - 1
dist/inputmask/bindings/inputmask.binding.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 5
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {
@@ -39,10 +39,6 @@
         var i = 0;
         if (isArraylike(obj)) for (var length = obj.length; i < length && !1 !== callback.call(obj[i], i, obj[i]); i++) ; else for (i in obj) if (!1 === callback.call(obj[i], i, obj[i])) break;
         return obj;
-    }, $.map = function(elems, callback) {
-        var value, i = 0, length = elems.length, ret = [];
-        if (isArraylike(elems)) for (;i < length; i++) null != (value = callback(elems[i], i)) && ret.push(value); else for (i in elems) null != (value = callback(elems[i], i)) && ret.push(value);
-        return [].concat(ret);
     }, $.data = function(elem, name, data) {
         return $(elem).data(name, data);
     }, $.Event = $.Event || function(event, params) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 5
dist/inputmask/dependencyLibs/inputmask.dependencyLib.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {
@@ -109,10 +109,6 @@
         var i = 0;
         if (isArraylike(obj)) for (var length = obj.length; i < length && !1 !== callback.call(obj[i], i, obj[i]); i++) ; else for (i in obj) if (!1 === callback.call(obj[i], i, obj[i])) break;
         return obj;
-    }, DependencyLib.map = function(elems, callback) {
-        var value, i = 0, length = elems.length, ret = [];
-        if (isArraylike(elems)) for (;i < length; i++) null != (value = callback(elems[i], i)) && ret.push(value); else for (i in elems) null != (value = callback(elems[i], i)) && ret.push(value);
-        return [].concat(ret);
     }, DependencyLib.data = function(owner, key, value) {
         if (void 0 === value) return owner.__data ? owner.__data[key] : null;
         owner.__data = owner.__data || {}, owner.__data[key] = value;

+ 1 - 1
dist/inputmask/global/document.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/global/window.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 "function" == typeof define && define.amd ? define(function() {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 6 - 5
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {
@@ -195,11 +195,14 @@
                                         for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
                                             var altMatch2 = malternateMatches[ndx2];
                                             if ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
+                                                var ss;
                                                 if (function(source, target) {
                                                     return source.match.nativeDef === target.match.nativeDef || source.match.def === target.match.nativeDef || source.match.nativeDef === target.match.def;
-                                                }(altMatch, altMatch2)) {
+                                                }(altMatch, altMatch2) || (ss = function(source, target) {
+                                                    return opts.regex !== undefined && null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
+                                                }(altMatch, altMatch2))) {
                                                     dropMatch = !0, altMatch.alternation === altMatch2.alternation && -1 === altMatch2.locator[altMatch2.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) && setMergeLocators(altMatch2, altMatch), 
-                                                    altMatch.match.nativeDef !== altMatch2.match.nativeDef && altMatch.match.nativeDef === altMatch2.match.def && (dropMatch = !1);
+                                                    altMatch.match.nativeDef === altMatch2.match.nativeDef || altMatch.match.nativeDef !== altMatch2.match.def && !ss || (dropMatch = !1);
                                                     break;
                                                 }
                                                 if (altMatch.match.def === altMatch2.match.def) {
@@ -208,8 +211,6 @@
                                                 }
                                                 if (function(source, target) {
                                                     return null === source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def, getMaskSet(), pos, !1, opts, !1);
-                                                }(altMatch, altMatch2) || function(source, target) {
-                                                    return null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
                                                 }(altMatch, altMatch2)) {
                                                     altMatch.alternation === altMatch2.alternation && -1 === altMatch.locator[altMatch.alternation].toString().indexOf(altMatch2.locator[altMatch2.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na || altMatch.locator[altMatch.alternation].toString(), 
                                                     -1 === altMatch.na.indexOf(altMatch.locator[altMatch.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na + "," + altMatch.locator[altMatch2.alternation].toString().split("")[0]), 

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-be.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ca.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-mx.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-nl.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ru.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-uk.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-us.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(factory) {

+ 6 - 5
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 !function(modules) {
@@ -240,11 +240,14 @@
                                             for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
                                                 var altMatch2 = malternateMatches[ndx2];
                                                 if ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr)) {
+                                                    var ss;
                                                     if (function(source, target) {
                                                         return source.match.nativeDef === target.match.nativeDef || source.match.def === target.match.nativeDef || source.match.nativeDef === target.match.def;
-                                                    }(altMatch, altMatch2)) {
+                                                    }(altMatch, altMatch2) || (ss = function(source, target) {
+                                                        return opts.regex !== undefined && null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
+                                                    }(altMatch, altMatch2))) {
                                                         dropMatch = !0, altMatch.alternation === altMatch2.alternation && -1 === altMatch2.locator[altMatch2.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) && setMergeLocators(altMatch2, altMatch), 
-                                                        altMatch.match.nativeDef !== altMatch2.match.nativeDef && altMatch.match.nativeDef === altMatch2.match.def && (dropMatch = !1);
+                                                        altMatch.match.nativeDef === altMatch2.match.nativeDef || altMatch.match.nativeDef !== altMatch2.match.def && !ss || (dropMatch = !1);
                                                         break;
                                                     }
                                                     if (altMatch.match.def === altMatch2.match.def) {
@@ -253,8 +256,6 @@
                                                     }
                                                     if (function(source, target) {
                                                         return null === source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def, getMaskSet(), pos, !1, opts, !1);
-                                                    }(altMatch, altMatch2) || function(source, target) {
-                                                        return null !== source.match.fn && null !== target.match.fn && target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, !1, opts, !1);
                                                     }(altMatch, altMatch2)) {
                                                         altMatch.alternation === altMatch2.alternation && -1 === altMatch.locator[altMatch.alternation].toString().indexOf(altMatch2.locator[altMatch2.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na || altMatch.locator[altMatch.alternation].toString(), 
                                                         -1 === altMatch.na.indexOf(altMatch.locator[altMatch.alternation].toString().split("")[0]) && (altMatch.na = altMatch.na + "," + altMatch.locator[altMatch2.alternation].toString().split("")[0]), 

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/bindings/inputmask.binding.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js


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

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

File diff suppressed because it is too large
+ 2 - 2
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js


+ 1 - 1
dist/min/inputmask/global/document.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 "function"==typeof define&&define.amd?define(function(){return document}):"object"==typeof exports&&(module.exports=document);

+ 1 - 1
dist/min/inputmask/global/window.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2017 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-76
+* Version: 4.0.0-77
 */
 
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);

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


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


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


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


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


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


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-be.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ca.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-mx.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-nl.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ru.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-uk.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-us.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone.min.js


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


+ 0 - 31
js/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -161,37 +161,6 @@
 
         return obj;
     };
-    $.map = function (elems, callback) {
-        var value,
-            i = 0,
-            length = elems.length,
-            isArray = isArraylike(elems),
-            ret = [];
-
-        // Go through the array, translating each of the items to their new values
-        if (isArray) {
-            for (; i < length; i++) {
-                value = callback(elems[i], i);
-
-                if (value != null) {
-                    ret.push(value);
-                }
-            }
-
-            // Go through every key on the object,
-        } else {
-            for (i in elems) {
-                value = callback(elems[i], i);
-
-                if (value != null) {
-                    ret.push(value);
-                }
-            }
-        }
-
-        // Flatten any nested arrays
-        return [].concat(ret);
-    };
     $.data = function (elem, name, data) {
         return $(elem).data(name, data);
     };

+ 0 - 31
js/dependencyLibs/inputmask.dependencyLib.js

@@ -358,37 +358,6 @@
 
         return obj;
     };
-    DependencyLib.map = function (elems, callback) {
-        var value,
-            i = 0,
-            length = elems.length,
-            isArray = isArraylike(elems),
-            ret = [];
-
-        // Go through the array, translating each of the items to their new values
-        if (isArray) {
-            for (; i < length; i++) {
-                value = callback(elems[i], i);
-
-                if (value != null) {
-                    ret.push(value);
-                }
-            }
-
-            // Go through every key on the object,
-        } else {
-            for (i in elems) {
-                value = callback(elems[i], i);
-
-                if (value != null) {
-                    ret.push(value);
-                }
-            }
-        }
-
-        // Flatten any nested arrays
-        return [].concat(ret);
-    };
 
     DependencyLib.data = function (owner, key, value) {
         if (value === undefined) {

+ 5 - 4
js/inputmask.js

@@ -995,7 +995,7 @@
                     }
 
                     function isSubsetOf(source, target) {
-                        if (source.match.fn !== null && target.match.fn !== null) { //is regex a subset
+                        if (opts.regex !== undefined && source.match.fn !== null && target.match.fn !== null) { //is regex a subset
                             //do we need a dfa for this?
                             //currently only a simplistic approach
                             return target.match.fn.test(source.match.def.replace(/[\[\]]/g, ""), getMaskSet(), pos, false, opts, false);
@@ -1088,20 +1088,21 @@
                                             var altMatch2 = malternateMatches[ndx2];
                                             //verify equality
                                             if (typeof altIndex !== "string" || $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr) !== -1) {
-                                                if (definitionCanMatchDefinition(altMatch, altMatch2)) {
+                                                var ss;
+                                                if (definitionCanMatchDefinition(altMatch, altMatch2) || (ss = isSubsetOf(altMatch, altMatch2))) {
                                                     dropMatch = true;
                                                     if (altMatch.alternation === altMatch2.alternation &&
                                                         altMatch2.locator[altMatch2.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) === -1) {
                                                         setMergeLocators(altMatch2, altMatch);
                                                     }
-                                                    if (altMatch.match.nativeDef !== altMatch2.match.nativeDef && altMatch.match.nativeDef === altMatch2.match.def) {
+                                                    if (altMatch.match.nativeDef !== altMatch2.match.nativeDef && (altMatch.match.nativeDef === altMatch2.match.def || ss)) {
                                                         dropMatch = false;
                                                     }
                                                     break;
                                                 } else if (altMatch.match.def === altMatch2.match.def) {
                                                     dropMatch = false;
                                                     break;
-                                                } else if (staticCanMatchDefinition(altMatch, altMatch2) || isSubsetOf(altMatch, altMatch2)) {
+                                                } else if (staticCanMatchDefinition(altMatch, altMatch2)) {
                                                     if (altMatch.alternation === altMatch2.alternation &&
                                                         altMatch.locator[altMatch.alternation].toString().indexOf(altMatch2.locator[altMatch2.alternation].toString().split("")[0]) === -1) {
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.0-76",
+  "version": "4.0.0-77",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
   "main": "index.js",
   "files": [

+ 41 - 0
qunit/tests_alternations.js

@@ -301,4 +301,45 @@ export default function (qunit, $, Inputmask) {
         $("#testmask").Type("34");
         assert.equal(testmask.inputmask._valueGet(), "3/4", "Result " + testmask.inputmask._valueGet());
     });
+
+    qunit.test("(99)|(*a)", function (assert) {
+        var $fixture = $("#qunit-fixture");
+        $fixture.append('<input type="text" id="testmask" />');
+        var testmask = document.getElementById("testmask");
+
+        Inputmask("(99)|(*a)").mask(testmask);
+        testmask.focus();
+        $("#testmask").Type("12");
+        assert.equal(testmask.inputmask._valueGet(), "12", "Result " + testmask.inputmask._valueGet());
+    });
+    qunit.test("(99)|(*a)", function (assert) {
+        var $fixture = $("#qunit-fixture");
+        $fixture.append('<input type="text" id="testmask" />');
+        var testmask = document.getElementById("testmask");
+
+        Inputmask("(99)|(*a)").mask(testmask);
+        testmask.focus();
+        $("#testmask").Type("1a");
+        assert.equal(testmask.inputmask._valueGet(), "1a", "Result " + testmask.inputmask._valueGet());
+    });
+    qunit.test("(99)|(*a)", function (assert) {
+        var $fixture = $("#qunit-fixture");
+        $fixture.append('<input type="text" id="testmask" />');
+        var testmask = document.getElementById("testmask");
+
+        Inputmask("(99)|(*a)").mask(testmask);
+        testmask.focus();
+        $("#testmask").Type("ab");
+        assert.equal(testmask.inputmask._valueGet(), "ab", "Result " + testmask.inputmask._valueGet());
+    });
+    qunit.test("(99)|(*a)", function (assert) {
+        var $fixture = $("#qunit-fixture");
+        $fixture.append('<input type="text" id="testmask" />');
+        var testmask = document.getElementById("testmask");
+
+        Inputmask("(99)|(*a)").mask(testmask);
+        testmask.focus();
+        $("#testmask").Type("a2");
+        assert.equal(testmask.inputmask._valueGet(), "a_", "Result " + testmask.inputmask._valueGet());
+    });
 };