Browse Source

Merge pull request #119 from ericlamb/dev

Clearing optional tail on mask assignment
Robin Herbots 13 years ago
parent
commit
66122b65a2
1 changed files with 7 additions and 2 deletions
  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
                     $input.addClass('focus.inputmask');
                     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);