浏览代码

remove settimeout in applying the mask

Robin Herbots 13 年之前
父节点
当前提交
6220d47712
共有 1 个文件被更改,包括 7 次插入8 次删除
  1. 7 8
      jquery.inputmask.js

+ 7 - 8
jquery.inputmask.js

@@ -600,14 +600,13 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                 });
                 });
                 }
                 }
 
 
-                setTimeout(function() {
-                    lastPosition = checkVal(el, buffer, true);
-                    if (document.activeElement === el) { //position the caret when in focus
-                        $input.addClass('focus.inputmask');
-                        caret(el, lastPosition);
-                    } else if (opts.clearMaskOnLostFocus && el._valueGet() == _buffer.join(''))
-                        el._valueSet('');
-                }, 0);
+                //apply mask
+                lastPosition = checkVal(el, buffer, true);
+                if (document.activeElement === el) { //position the caret when in focus
+                  $input.addClass('focus.inputmask');
+                  caret(el, lastPosition);
+                } else if (opts.clearMaskOnLostFocus && el._valueGet() == _buffer.join(''))
+                      el._valueSet('');
 
 
                 //private functions
                 //private functions
                 function patchValueProperty(npt) {
                 function patchValueProperty(npt) {