Browse Source

fix for clearOnIncopmplete

Robin Herbots 13 years ago
parent
commit
446f4385bf
1 changed files with 4 additions and 6 deletions
  1. 4 6
      js/jquery.inputmask.js

+ 4 - 6
js/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 - 2012 Robin Herbots
 Copyright (c) 2010 - 2012 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: 1.0.0
+Version: 1.0.1
  
  
 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)
 */
 */
@@ -410,7 +410,6 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
             }
             }
 
 
             function clearOptionalTail(input, buffer) {
             function clearOptionalTail(input, buffer) {
-                setTimeout(function() {
                     var tmpBuffer = buffer.slice();
                     var tmpBuffer = buffer.slice();
                     if ($(input).data('inputmask')['isRTL']) {
                     if ($(input).data('inputmask')['isRTL']) {
                         for (var pos = 0; pos <= tmpBuffer.length - 1; pos++) {
                         for (var pos = 0; pos <= tmpBuffer.length - 1; pos++) {
@@ -432,7 +431,6 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                         }
                         }
                     }
                     }
                     writeBuffer(input, tmpBuffer);
                     writeBuffer(input, tmpBuffer);
-                }, 0);
             }
             }
 
 
             //functionality fn
             //functionality fn
@@ -535,9 +533,6 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                 }).bind("blur.inputmask", function() {
                 }).bind("blur.inputmask", function() {
                     var $input = $(this), input = this, nptValue = input._valueGet();
                     var $input = $(this), input = this, nptValue = input._valueGet();
                     $input.removeClass('focus.inputmask');
                     $input.removeClass('focus.inputmask');
-                    if (nptValue != undoBuffer) {
-                        $input.change();
-                    }
                     if (opts.clearMaskOnLostFocus) {
                     if (opts.clearMaskOnLostFocus) {
                         if (nptValue == _buffer.join(''))
                         if (nptValue == _buffer.join(''))
                             input._valueSet('');
                             input._valueSet('');
@@ -558,6 +553,9 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                             }
                             }
                         }
                         }
                     }
                     }
+                    if (input._valueGet() != undoBuffer) {
+                        $input.change();
+                    }
                 }).bind("focus.inputmask", function() {
                 }).bind("focus.inputmask", function() {
                     var $input = $(this), input = this;
                     var $input = $(this), input = this;
                     $input.addClass('focus.inputmask');
                     $input.addClass('focus.inputmask');