Browse Source

fix Nested alternator groups not working #750

Robin Herbots 9 years ago
parent
commit
7f2b35e17a

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "jquery.inputmask",
   "name": "jquery.inputmask",
-  "version": "3.3.4-113",
+  "version": "3.3.4-119",
   "main": [
   "main": [
 	  "./dist/inputmask/inputmask.dependencyLib",
 	  "./dist/inputmask/inputmask.dependencyLib",
 	  "./dist/inputmask/inputmask",
 	  "./dist/inputmask/inputmask",

+ 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.3.4-113",
+	"version": "3.3.4-119",
 	"keywords": [
 	"keywords": [
 		"jquery",
 		"jquery",
 		"plugins",
 		"plugins",

+ 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.3.4-113",
+  "version": "3.3.4-119",
   "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 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), 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"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define("inputmask.dependencyLib", [ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);
     "function" == typeof define && define.amd ? define("inputmask.dependencyLib", [ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), 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"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 18 - 20
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define("inputmask", [ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib")) : factory(window.dependencyLib || jQuery);
     "function" == typeof define && define.amd ? define("inputmask", [ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib")) : factory(window.dependencyLib || jQuery);
@@ -1360,8 +1360,8 @@
         },
         },
         analyseMask: function(mask, opts) {
         analyseMask: function(mask, opts) {
             function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
             function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
-                this.matches = [], this.isGroup = isGroup || !1, this.isOptional = isOptional || !1, 
-                this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1, 
+                this.matches = [], this.openGroup = isGroup || !1, this.isGroup = isGroup || !1, 
+                this.isOptional = isOptional || !1, this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1, 
                 this.quantifier = {
                 this.quantifier = {
                     min: 1,
                     min: 1,
                     max: 1
                     max: 1
@@ -1411,24 +1411,24 @@
                     nativeDef: element
                     nativeDef: element
                 }), escaped = !1;
                 }), escaped = !1;
             }
             }
-            function verifyGroupMarker(lastMatch, isOpenGroup) {
-                lastMatch && lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0), 
-                isOpenGroup !== !0 && insertTestDefinition(lastMatch, opts.groupmarker.end));
-            }
-            function maskCurrentToken(m, currentToken, lastMatch, extraCondition) {
-                currentToken.matches.length > 0 && (void 0 === extraCondition || extraCondition) && (lastMatch = currentToken.matches[currentToken.matches.length - 1], 
-                verifyGroupMarker(lastMatch)), insertTestDefinition(currentToken, m);
+            function verifyGroupMarker(maskToken) {
+                $.each(maskToken.matches, function(ndx, token) {
+                    var nextToken = maskToken.matches[ndx + 1];
+                    (void 0 === nextToken || void 0 === nextToken.matches || nextToken.isQuantifier === !1) && token && token.isGroup && (token.isGroup = !1, 
+                    insertTestDefinition(token, opts.groupmarker.start, 0), token.openGroup !== !0 && insertTestDefinition(token, opts.groupmarker.end)), 
+                    verifyGroupMarker(token);
+                });
             }
             }
             function defaultCase() {
             function defaultCase() {
                 if (openenings.length > 0) {
                 if (openenings.length > 0) {
-                    if (currentOpeningToken = openenings[openenings.length - 1], maskCurrentToken(m, currentOpeningToken, lastMatch, !currentOpeningToken.isAlternator), 
+                    if (currentOpeningToken = openenings[openenings.length - 1], insertTestDefinition(currentOpeningToken, m), 
                     currentOpeningToken.isAlternator) {
                     currentOpeningToken.isAlternator) {
                         alternator = openenings.pop();
                         alternator = openenings.pop();
                         for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
                         for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
                         openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], 
                         openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], 
                         currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
                         currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
                     }
                     }
-                } else maskCurrentToken(m, currentToken, lastMatch);
+                } else insertTestDefinition(currentToken, m);
             }
             }
             function reverseTokens(maskToken) {
             function reverseTokens(maskToken) {
                 function reverseStatic(st) {
                 function reverseStatic(st) {
@@ -1454,7 +1454,7 @@
 
 
               case opts.optionalmarker.end:
               case opts.optionalmarker.end:
               case opts.groupmarker.end:
               case opts.groupmarker.end:
-                if (openingToken = openenings.pop(), void 0 !== openingToken) if (openenings.length > 0) {
+                if (openingToken = openenings.pop(), openingToken.openGroup = !1, void 0 !== openingToken) if (openenings.length > 0) {
                     if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken), 
                     if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken), 
                     currentOpeningToken.isAlternator) {
                     currentOpeningToken.isAlternator) {
                         alternator = openenings.pop();
                         alternator = openenings.pop();
@@ -1466,11 +1466,11 @@
                 break;
                 break;
 
 
               case opts.optionalmarker.start:
               case opts.optionalmarker.start:
-                verifyGroupMarker(currentToken.matches[currentToken.matches.length - 1]), openenings.push(new MaskToken((!1), (!0)));
+                openenings.push(new MaskToken((!1), (!0)));
                 break;
                 break;
 
 
               case opts.groupmarker.start:
               case opts.groupmarker.start:
-                verifyGroupMarker(currentToken.matches[currentToken.matches.length - 1]), openenings.push(new MaskToken((!0)));
+                openenings.push(new MaskToken((!0)));
                 break;
                 break;
 
 
               case opts.quantifiermarker.start:
               case opts.quantifiermarker.start:
@@ -1499,11 +1499,9 @@
               default:
               default:
                 defaultCase();
                 defaultCase();
             }
             }
-            for (;openenings.length > 0; ) openingToken = openenings.pop(), verifyGroupMarker(openingToken, !0), 
-            currentToken.matches.push(openingToken);
-            return currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1], 
-            verifyGroupMarker(lastMatch), maskTokens.push(currentToken)), opts.numericInput && reverseTokens(maskTokens[0]), 
-            maskTokens;
+            for (;openenings.length > 0; ) openingToken = openenings.pop(), currentToken.matches.push(openingToken);
+            return currentToken.matches.length > 0 && (verifyGroupMarker(currentToken), maskTokens.push(currentToken)), 
+            opts.numericInput && reverseTokens(maskTokens[0]), maskTokens;
         }
         }
     }, Inputmask.extendDefaults = function(options) {
     }, Inputmask.extendDefaults = function(options) {
         $.extend(!0, Inputmask.prototype.defaults, options);
         $.extend(!0, Inputmask.prototype.defaults, options);

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), 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"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), 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"), 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
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(factory) {
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), 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"), 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
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !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);

+ 18 - 20
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function($) {
 !function($) {
     function Inputmask(alias, options) {
     function Inputmask(alias, options) {
@@ -1358,8 +1358,8 @@
         },
         },
         analyseMask: function(mask, opts) {
         analyseMask: function(mask, opts) {
             function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
             function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
-                this.matches = [], this.isGroup = isGroup || !1, this.isOptional = isOptional || !1, 
-                this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1, 
+                this.matches = [], this.openGroup = isGroup || !1, this.isGroup = isGroup || !1, 
+                this.isOptional = isOptional || !1, this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1, 
                 this.quantifier = {
                 this.quantifier = {
                     min: 1,
                     min: 1,
                     max: 1
                     max: 1
@@ -1409,24 +1409,24 @@
                     nativeDef: element
                     nativeDef: element
                 }), escaped = !1;
                 }), escaped = !1;
             }
             }
-            function verifyGroupMarker(lastMatch, isOpenGroup) {
-                lastMatch && lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0), 
-                isOpenGroup !== !0 && insertTestDefinition(lastMatch, opts.groupmarker.end));
-            }
-            function maskCurrentToken(m, currentToken, lastMatch, extraCondition) {
-                currentToken.matches.length > 0 && (void 0 === extraCondition || extraCondition) && (lastMatch = currentToken.matches[currentToken.matches.length - 1], 
-                verifyGroupMarker(lastMatch)), insertTestDefinition(currentToken, m);
+            function verifyGroupMarker(maskToken) {
+                $.each(maskToken.matches, function(ndx, token) {
+                    var nextToken = maskToken.matches[ndx + 1];
+                    (void 0 === nextToken || void 0 === nextToken.matches || nextToken.isQuantifier === !1) && token && token.isGroup && (token.isGroup = !1, 
+                    insertTestDefinition(token, opts.groupmarker.start, 0), token.openGroup !== !0 && insertTestDefinition(token, opts.groupmarker.end)), 
+                    verifyGroupMarker(token);
+                });
             }
             }
             function defaultCase() {
             function defaultCase() {
                 if (openenings.length > 0) {
                 if (openenings.length > 0) {
-                    if (currentOpeningToken = openenings[openenings.length - 1], maskCurrentToken(m, currentOpeningToken, lastMatch, !currentOpeningToken.isAlternator), 
+                    if (currentOpeningToken = openenings[openenings.length - 1], insertTestDefinition(currentOpeningToken, m), 
                     currentOpeningToken.isAlternator) {
                     currentOpeningToken.isAlternator) {
                         alternator = openenings.pop();
                         alternator = openenings.pop();
                         for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
                         for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
                         openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], 
                         openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], 
                         currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
                         currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
                     }
                     }
-                } else maskCurrentToken(m, currentToken, lastMatch);
+                } else insertTestDefinition(currentToken, m);
             }
             }
             function reverseTokens(maskToken) {
             function reverseTokens(maskToken) {
                 function reverseStatic(st) {
                 function reverseStatic(st) {
@@ -1452,7 +1452,7 @@
 
 
               case opts.optionalmarker.end:
               case opts.optionalmarker.end:
               case opts.groupmarker.end:
               case opts.groupmarker.end:
-                if (openingToken = openenings.pop(), void 0 !== openingToken) if (openenings.length > 0) {
+                if (openingToken = openenings.pop(), openingToken.openGroup = !1, void 0 !== openingToken) if (openenings.length > 0) {
                     if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken), 
                     if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken), 
                     currentOpeningToken.isAlternator) {
                     currentOpeningToken.isAlternator) {
                         alternator = openenings.pop();
                         alternator = openenings.pop();
@@ -1464,11 +1464,11 @@
                 break;
                 break;
 
 
               case opts.optionalmarker.start:
               case opts.optionalmarker.start:
-                verifyGroupMarker(currentToken.matches[currentToken.matches.length - 1]), openenings.push(new MaskToken((!1), (!0)));
+                openenings.push(new MaskToken((!1), (!0)));
                 break;
                 break;
 
 
               case opts.groupmarker.start:
               case opts.groupmarker.start:
-                verifyGroupMarker(currentToken.matches[currentToken.matches.length - 1]), openenings.push(new MaskToken((!0)));
+                openenings.push(new MaskToken((!0)));
                 break;
                 break;
 
 
               case opts.quantifiermarker.start:
               case opts.quantifiermarker.start:
@@ -1497,11 +1497,9 @@
               default:
               default:
                 defaultCase();
                 defaultCase();
             }
             }
-            for (;openenings.length > 0; ) openingToken = openenings.pop(), verifyGroupMarker(openingToken, !0), 
-            currentToken.matches.push(openingToken);
-            return currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1], 
-            verifyGroupMarker(lastMatch), maskTokens.push(currentToken)), opts.numericInput && reverseTokens(maskTokens[0]), 
-            maskTokens;
+            for (;openenings.length > 0; ) openingToken = openenings.pop(), currentToken.matches.push(openingToken);
+            return currentToken.matches.length > 0 && (verifyGroupMarker(currentToken), maskTokens.push(currentToken)), 
+            opts.numericInput && reverseTokens(maskTokens[0]), maskTokens;
         }
         }
     }, Inputmask.extendDefaults = function(options) {
     }, Inputmask.extendDefaults = function(options) {
         $.extend(!0, Inputmask.prototype.defaults, options);
         $.extend(!0, Inputmask.prototype.defaults, options);

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


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

@@ -3,6 +3,6 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * https://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.3.4-113
+* Version: 3.3.4-119
 */
 */
 !function(a){"function"==typeof define&&define.amd?define("inputmask.dependencyLib",["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("inputmask.dependencyLib",["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return window.dependencyLib=a,a});

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/inputmask.regex.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
+ 3 - 3
dist/min/jquery.inputmask.bundle.min.js


+ 19 - 23
js/inputmask.js

@@ -296,6 +296,7 @@
 
 
 			function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
 			function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
 				this.matches = [];
 				this.matches = [];
+				this.openGroup = isGroup || false;
 				this.isGroup = isGroup || false;
 				this.isGroup = isGroup || false;
 				this.isOptional = isOptional || false;
 				this.isOptional = isOptional || false;
 				this.isQuantifier = isQuantifier || false;
 				this.isQuantifier = isQuantifier || false;
@@ -361,28 +362,25 @@
 				}
 				}
 			}
 			}
 
 
-			function verifyGroupMarker(lastMatch, isOpenGroup) {
-				if (lastMatch && lastMatch.isGroup) { //this is not a group but a normal mask => convert
-					lastMatch.isGroup = false;
-					insertTestDefinition(lastMatch, opts.groupmarker.start, 0);
-					if (isOpenGroup !== true) {
-						insertTestDefinition(lastMatch, opts.groupmarker.end);
+			function verifyGroupMarker(maskToken) {
+				$.each(maskToken.matches, function (ndx, token) {
+						var nextToken = maskToken.matches[ndx + 1];
+						if ((nextToken === undefined || (nextToken.matches === undefined || nextToken.isQuantifier === false)) && token && token.isGroup) { //this is not a group but a normal mask => convert
+							token.isGroup = false;
+							insertTestDefinition(token, opts.groupmarker.start, 0);
+							if (token.openGroup !== true) {
+								insertTestDefinition(token, opts.groupmarker.end);
+							}
+						}
+						verifyGroupMarker(token);
 					}
 					}
-				}
-			}
-
-			function maskCurrentToken(m, currentToken, lastMatch, extraCondition) {
-				if (currentToken.matches.length > 0 && (extraCondition === undefined || extraCondition)) {
-					lastMatch = currentToken.matches[currentToken.matches.length - 1];
-					verifyGroupMarker(lastMatch);
-				}
-				insertTestDefinition(currentToken, m);
+				);
 			}
 			}
 
 
 			function defaultCase() {
 			function defaultCase() {
 				if (openenings.length > 0) {
 				if (openenings.length > 0) {
 					currentOpeningToken = openenings[openenings.length - 1];
 					currentOpeningToken = openenings[openenings.length - 1];
-					maskCurrentToken(m, currentOpeningToken, lastMatch, !currentOpeningToken.isAlternator);
+					insertTestDefinition(currentOpeningToken, m);
 					if (currentOpeningToken.isAlternator) { //handle alternator a | b case
 					if (currentOpeningToken.isAlternator) { //handle alternator a | b case
 						alternator = openenings.pop();
 						alternator = openenings.pop();
 						for (var mndx = 0; mndx < alternator.matches.length; mndx++) {
 						for (var mndx = 0; mndx < alternator.matches.length; mndx++) {
@@ -396,7 +394,7 @@
 						}
 						}
 					}
 					}
 				} else {
 				} else {
-					maskCurrentToken(m, currentToken, lastMatch);
+					insertTestDefinition(currentToken, m);
 				}
 				}
 			}
 			}
 
 
@@ -444,6 +442,7 @@
 					case opts.groupmarker.end:
 					case opts.groupmarker.end:
 						// Group closing
 						// Group closing
 						openingToken = openenings.pop();
 						openingToken = openenings.pop();
+						openingToken.openGroup = false; //mark group as complete
 						if (openingToken !== undefined) {
 						if (openingToken !== undefined) {
 							if (openenings.length > 0) {
 							if (openenings.length > 0) {
 								currentOpeningToken = openenings[openenings.length - 1];
 								currentOpeningToken = openenings[openenings.length - 1];
@@ -466,12 +465,10 @@
 						} else defaultCase();
 						} else defaultCase();
 						break;
 						break;
 					case opts.optionalmarker.start:
 					case opts.optionalmarker.start:
-						verifyGroupMarker(currentToken.matches[currentToken.matches.length - 1]);
 						// optional opening
 						// optional opening
 						openenings.push(new MaskToken(false, true));
 						openenings.push(new MaskToken(false, true));
 						break;
 						break;
 					case opts.groupmarker.start:
 					case opts.groupmarker.start:
-						verifyGroupMarker(currentToken.matches[currentToken.matches.length - 1]);
 						// Group opening
 						// Group opening
 						openenings.push(new MaskToken(true));
 						openenings.push(new MaskToken(true));
 						break;
 						break;
@@ -511,7 +508,8 @@
 							currentToken.matches.push(quantifier);
 							currentToken.matches.push(quantifier);
 						}
 						}
 						break;
 						break;
-					case opts.alternatormarker:
+					case
+					opts.alternatormarker:
 						if (openenings.length > 0) {
 						if (openenings.length > 0) {
 							currentOpeningToken = openenings[openenings.length - 1];
 							currentOpeningToken = openenings[openenings.length - 1];
 							lastMatch = currentOpeningToken.matches.pop();
 							lastMatch = currentOpeningToken.matches.pop();
@@ -533,12 +531,10 @@
 
 
 			while (openenings.length > 0) {
 			while (openenings.length > 0) {
 				openingToken = openenings.pop();
 				openingToken = openenings.pop();
-				verifyGroupMarker(openingToken, true);
 				currentToken.matches.push(openingToken);
 				currentToken.matches.push(openingToken);
 			}
 			}
 			if (currentToken.matches.length > 0) {
 			if (currentToken.matches.length > 0) {
-				lastMatch = currentToken.matches[currentToken.matches.length - 1];
-				verifyGroupMarker(lastMatch);
+				verifyGroupMarker(currentToken);
 				maskTokens.push(currentToken);
 				maskTokens.push(currentToken);
 			}
 			}
 
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
 	"name": "jquery.inputmask",
 	"name": "jquery.inputmask",
-	"version": "3.3.4-113",
+	"version": "3.3.4-119",
 	"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": "index.js",
 	"main": "index.js",
 	"files": [
 	"files": [

+ 31 - 0
qunit/tests_alternations.js

@@ -133,4 +133,35 @@ define([
 
 
 		assert.equal(testmask.inputmask._valueGet(), "NE-123", "Result " + testmask.inputmask._valueGet());
 		assert.equal(testmask.inputmask._valueGet(), "NE-123", "Result " + testmask.inputmask._valueGet());
 	});
 	});
+
+	qunit.test("alternations (9{1,3})|((S|N)(E|W))-9{1,3} - yesman85", function (assert) {
+		var $fixture = $("#qunit-fixture");
+		$fixture.append('<input type="text" id="testmask" />');
+		var testmask = document.getElementById("testmask");
+
+		Inputmask("(9{1,3})|((S|N)(E|W))-9{1,3}").mask(testmask);
+
+		$("#testmask").Type("(NE123");
+
+		assert.equal(testmask.inputmask._valueGet(), "(N)(E)-123", "Result " + testmask.inputmask._valueGet());
+	});
+
+	qunit.test("((S))", function (assert) {
+		var $fixture = $("#qunit-fixture");
+		$fixture.append('<input type="text" id="testmask" />');
+		var testmask = document.getElementById("testmask");
+
+		Inputmask("((S))").mask(testmask);
+		testmask.focus();
+		assert.equal(testmask.inputmask._valueGet(), "((S))", "Result " + testmask.inputmask._valueGet());
+	});
+	qunit.test("((S)", function (assert) {
+		var $fixture = $("#qunit-fixture");
+		$fixture.append('<input type="text" id="testmask" />');
+		var testmask = document.getElementById("testmask");
+
+		Inputmask("((S)").mask(testmask);
+		testmask.focus();
+		assert.equal(testmask.inputmask._valueGet(), "((S)", "Result " + testmask.inputmask._valueGet());
+	});
 });
 });