ソースを参照

Merge branch '1.x' into 2.x

Robin Herbots 13 年 前
コミット
0aeed38bb5
1 ファイル変更9 行追加6 行削除
  1. 9 6
      js/jquery.inputmask.js

+ 9 - 6
js/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 2.1.0
+* Version: 2.1.0a
 */
 
 (function ($) {
@@ -60,6 +60,13 @@
             escapeRegex: function (str) {
                 var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
                 return str.replace(new RegExp('(\\' + specials.join('|\\') + ')', 'gim'), '\\$1');
+            },
+            getMaskLength: function (buffer, greedy, repeat) {
+                var calculatedLength = buffer.length;
+                if (!greedy && repeat > 1) {
+                    calculatedLength += (buffer.length * (repeat - 1));
+                }
+                return calculatedLength;
             }
         };
 
@@ -420,11 +427,7 @@
             }
 
             function getMaskLength() {
-                var calculatedLength = getActiveBuffer().length;
-                if (!opts.greedy && opts.repeat > 1) {
-                    calculatedLength += (getActiveBuffer().length * (opts.repeat - 1));
-                }
-                return calculatedLength;
+                return $.inputmask.getMaskLength(getActiveBuffer(), opts.greedy, opts.repeat);
             }
 
             //pos: from position