Browse Source

change repeat option to take the exact nummer of repetitions specified.
It is more clear that a repeat of 10 = 10 times the mask and not 11, ... 1 mask + 10 repetitions

Robin Herbots 15 years ago
parent
commit
5117f61d97
1 changed files with 3 additions and 3 deletions
  1. 3 3
      jquery.inputmask.js

+ 3 - 3
jquery.inputmask.js

@@ -3,7 +3,7 @@ Input Mask plugin for jquery
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 0.2.5a
+Version: 0.2.5b
    
 This plugin is based on the masked input plugin written by Josh Bush (digitalbush.com)
 */
@@ -159,7 +159,7 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
 
             //allocate repetitions
             var repeatedMask = singleMask.slice();
-            for (var i = 0; i < opts.repeat && opts.greedy; i++) {
+            for (var i = 1; i < opts.repeat && opts.greedy; i++) {
                 repeatedMask = repeatedMask.concat(singleMask.slice());
             }
             return repeatedMask;
@@ -271,7 +271,7 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
         function getMaskLength() {
             var calculatedLength = _buffer.length;
             if (!opts.greedy) {
-                calculatedLength += (_buffer.length * opts.repeat)
+                calculatedLength += (_buffer.length * (opts.repeat - 1))
             }
             return calculatedLength - _numberOfRemovedElementsFromMask;
         }