ソースを参照

Clearing optional tail on mask assignment

Eric Lamb 13 年 前
コミット
020b5c73c5
1 ファイル変更7 行追加2 行削除
  1. 7 2
      js/jquery.inputmask.js

+ 7 - 2
js/jquery.inputmask.js

@@ -669,8 +669,13 @@
                 if (document.activeElement === el) { //position the caret when in focus
                 if (document.activeElement === el) { //position the caret when in focus
                     $input.addClass('focus.inputmask');
                     $input.addClass('focus.inputmask');
                     caret(el, lastPosition);
                     caret(el, lastPosition);
-                } else if (opts.clearMaskOnLostFocus && el._valueGet() == _buffer.join(''))
-                    el._valueSet('');
+                } else if (opts.clearMaskOnLostFocus) {
+                    if (el._valueGet() == _buffer.join('')) {
+                        el._valueSet('');  
+                    } else {
+                        clearOptionalTail(el, buffer);  
+                    }
+                }
 
 
                 installEventRuler(el);
                 installEventRuler(el);