浏览代码

If I click label than I am in input assigned to label, but mask is not show.

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

+ 5 - 5
js/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2012 Robin Herbots
 * Copyright (c) 2010 - 2012 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: 1.2.6
+* Version: 1.2.7
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -606,7 +606,7 @@
                     if (nptValue != undoBuffer) {
                     if (nptValue != undoBuffer) {
                         $input.change();
                         $input.change();
                     }
                     }
-                    if (opts.clearMaskOnLostFocus) {
+                    if (opts.clearMaskOnLostFocus && nptValue != '') {
                         if (nptValue == _buffer.join(''))
                         if (nptValue == _buffer.join(''))
                             input._valueSet('');
                             input._valueSet('');
                         else { //clearout optional tail of the mask
                         else { //clearout optional tail of the mask
@@ -625,9 +625,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 = _buffer.slice();
                                 buffer = _buffer.slice();