Browse Source

fix for unblur event not fireing onchange intime

Robin Herbots 15 years ago
parent
commit
20d2af4ae2
1 changed files with 8 additions and 10 deletions
  1. 8 10
      jquery.inputmask.js

+ 8 - 10
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.2.3
+Version: 0.2.4
    
    
 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)
 */
 */
@@ -187,7 +187,7 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                                 newBlockMarker = false;
                                 newBlockMarker = false;
                         }
                         }
                         outElem.push([new RegExp(maskdef.validator), maskdef.cardinality, isOptional, newBlockMarker]);
                         outElem.push([new RegExp(maskdef.validator), maskdef.cardinality, isOptional, newBlockMarker]);
-                    } else outElem.push(null);
+                    } else outElem.push([null, 0, isOptional, newBlockMarker]);
 
 
                     //reset newBlockMarker
                     //reset newBlockMarker
                     newBlockMarker = false;
                     newBlockMarker = false;
@@ -213,7 +213,7 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
         }
         }
 
 
         function isMask(pos) {
         function isMask(pos) {
-            return tests[determineTestPosition(pos)];
+            return tests[determineTestPosition(pos)][0];
         }
         }
 
 
         function determineTestPosition(pos) {
         function determineTestPosition(pos) {
@@ -327,13 +327,11 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                     }
                     }
                 }).bind("blur.inputmask", function() {
                 }).bind("blur.inputmask", function() {
                     input.removeClass('focus.inputmask');
                     input.removeClass('focus.inputmask');
-                    setTimeout(function() {
-                        if (_val.call(input) == _buffer.join(''))
-                            _val.call(input, '');
-                        else if (_val.call(input) != undoBuffer) {
-                            input.change();
-                        }
-                    }, 0);
+                    if (_val.call(input) == _buffer.join(''))
+                        _val.call(input, '');
+                    else if (_val.call(input) != undoBuffer) {
+                        input.change();
+                    }
                 }).bind("focus.inputmask", function() {
                 }).bind("focus.inputmask", function() {
                     input.addClass('focus.inputmask');
                     input.addClass('focus.inputmask');
                     undoBuffer = _val.call(input);
                     undoBuffer = _val.call(input);