ソースを参照

Update in preparebuffer - allocate total mask for repeat instead of just 1 char

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

+ 6 - 9
jquery.inputmask.js

@@ -3,7 +3,7 @@ Input Mask plugin for jquery
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 Robin Herbots
 Copyright (c) 2010 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: 0.4.5b
+Version: 0.4.5c
  
  
 This plugin is based on the masked input plugin written by Josh Bush (digitalbush.com)
 This plugin is based on the masked input plugin written by Josh Bush (digitalbush.com)
 */
 */
@@ -317,18 +317,15 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
 
 
             function prepareBuffer(buffer, position) {
             function prepareBuffer(buffer, position) {
                 while ((buffer.length <= position || position < 0) && buffer.length < getMaskLength()) {
                 while ((buffer.length <= position || position < 0) && buffer.length < getMaskLength()) {
-                    var j;
+                    var j = 0;
                     if (opts.numericInput) {
                     if (opts.numericInput) {
                         j = determineTestPosition(position);
                         j = determineTestPosition(position);
                         buffer.unshift(_buffer[j]);
                         buffer.unshift(_buffer[j]);
                         position++;
                         position++;
-                    } else {
-                        for (var i = buffer.length; i <= position; i++) {
-                            j = determineTestPosition(i);
-                            buffer.push(_buffer[j]);
-                        }
-                    }
-                }
+                    } else while (_buffer[j] !== undefined) {
+                                buffer.push(_buffer[j++]);
+                           }
+            	}
             }
             }
 
 
             function writeBuffer(input, buffer, caretPos) {
             function writeBuffer(input, buffer, caretPos) {