浏览代码

style update

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

+ 8 - 5
js/inputmask.js

@@ -2727,9 +2727,8 @@
 				colorMask.style.width = parseInt(input.offsetWidth) - parseInt(computedStyle.paddingLeft) - parseInt(computedStyle.paddingRight) - parseInt(computedStyle.borderLeftWidth) - parseInt(computedStyle.borderRightWidth) + "px";
 				colorMask.style.height = parseInt(input.offsetHeight) - parseInt(computedStyle.paddingTop) - parseInt(computedStyle.paddingBottom) - parseInt(computedStyle.borderTopWidth) - parseInt(computedStyle.borderBottomWidth) + "px";
 
-				colorMask.style.padding = computedStyle.padding;
-				colorMask.style.margin = computedStyle.margin;
 				colorMask.style.lineHeight = colorMask.style.height;
+				colorMask.style.border = "";
 			}
 
 			var offset = $(input).position(),
@@ -2737,11 +2736,9 @@
 				parentNode = input.parentNode;
 
 			colorMask = document.createElement("div");
-
-			for (var style in computedStyle) {
+			for (var style in computedStyle) { //clone styles
 				colorMask.style[style] = computedStyle[style];
 			}
-			colorMask.style.border = "";
 			position();
 
 			parentNode.insertBefore(colorMask, input.nextSibling);
@@ -2843,7 +2840,13 @@
 				} else if (opts.colorMask !== false) {
 					if (opts.colorMask !== true)
 						initializeColorMask(el);
+
+					var computedStyle = (el.ownerDocument.defaultView || window).getComputedStyle(el, null);
 					el.type = "password";
+					for (var style in computedStyle) { //clone styles
+						el.style[style] = computedStyle[style];
+					}
+
 				}
 			}