Browse Source

Merge branch '1.x' into 2.x

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

+ 4 - 4
js/jquery.inputmask.js

@@ -713,7 +713,7 @@
                     if (nptValue != undoBuffer) {
                     if (nptValue != undoBuffer) {
                         $input.change();
                         $input.change();
                     }
                     }
-                    if (opts.clearMaskOnLostFocus) {
+					if (opts.clearMaskOnLostFocus && nptValue != '') {
                         if (nptValue == getActiveBuffer().join(''))
                         if (nptValue == getActiveBuffer().join(''))
                             input._valueSet('');
                             input._valueSet('');
                         else { //clearout optional tail of the mask
                         else { //clearout optional tail of the mask
@@ -732,9 +732,9 @@
                         }
                         }
                     }
                     }
                 }).bind("focus.inputmask", function () {
                 }).bind("focus.inputmask", function () {
-                    var $input = $(this), input = this;
-                    if (!$input.hasClass('focus.inputmask') && !opts.showMaskOnHover) {
-                        var nptL = input._valueGet().length;
+                    var $input = $(this), input = this, nptValue = input._valueGet();
+                    if (!$input.hasClass('focus.inputmask') && (!opts.showMaskOnHover || (opts.showMaskOnHover && nptValue == ''))) {
+                        var nptL = nptValue.length;
                         if (nptL < buffer.length) {
                         if (nptL < buffer.length) {
                             if (nptL == 0)
                             if (nptL == 0)
                                 buffer = getActiveBuffer().slice();
                                 buffer = getActiveBuffer().slice();