Robin Herbots 12 年 前
コミット
e0c130da71
2 ファイル変更10 行追加5 行削除
  1. 6 3
      js/jquery.inputmask.js
  2. 4 2
      qunit/tests.js

+ 6 - 3
js/jquery.inputmask.js

@@ -325,7 +325,7 @@
                         maskTemplate.push(test["fn"] == null ? test["def"] : opts.placeholder.charAt(pos % opts.placeholder.length));
                     }
                     pos++;
-                } while (test["fn"] != null || (test["fn"] == null && test["def"] != "") && opts.repeat != "*"); //fixme
+                } while (test["fn"] != null || (test["fn"] == null && test["def"] != ""));
 
                 return { "mask": maskTemplate, "repeat": opts.repeat, "greedy": opts.greedy };
             }
@@ -364,10 +364,13 @@
                             } else if (match.isQuantifier && quantifierRecurse !== true) {
                                 var qt = match;
                                 for (var qndx = (ndxInitializer.length > 0 && quantifierRecurse !== true) ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) ; qndx++) {
-
                                     match = handleMatch(maskToken.matches[maskToken.matches.indexOf(qt) - 1], [qndx].concat(loopNdx), true);
                                     if (match) {
                                         if (qndx >= qt.quantifier.min) { //search for next possible match
+                                            if (isNaN(qt.quantifier.max) && qndx > qt.quantifier.min) {
+                                                matches.push({ "match": { fn: null, cardinality: 0, optionality: true, casing: null, def: "" }, "locator": [] });
+                                                return true;
+                                            }
                                             testPos = currentPos;
                                         } else {
                                             return true;
@@ -443,7 +446,7 @@
 
             function getActiveBuffer() {
                 if (getActiveMaskSet()['buffer'] == undefined) {
-                    getActiveMaskSet()['buffer'] = getMaskTemplate(true)["mask"];
+                    getActiveMaskSet()['buffer'] = getMaskTemplate(/*true*/)["mask"];
                 }
                 return getActiveMaskSet()['buffer'];
             }

+ 4 - 2
qunit/tests.js

@@ -168,8 +168,10 @@ asyncTest("inputmask(\"9-AAA.999\", { onincomplete: ... })", 1, function () {
     });
 
     $("#testmask")[0].focus();
-    $("#testmask").Type("1abc12");
-    $("#testmask").blur();
+	setTimeout(function () {
+		$("#testmask").Type("1abc12");
+		$("#testmask").blur();
+	}, 0);
 });
 
 test("inputmask(\"999.999.999\") - delete 2nd with backspace, continue the mask", function () {