Browse Source

Merge pull request #1404 from whooehoo/3.x

Fix mask position on android
Robin Herbots 9 years ago
parent
commit
235be76049
2 changed files with 8 additions and 12 deletions
  1. 4 6
      dist/inputmask/inputmask.js
  2. 4 6
      dist/jquery.inputmask.bundle.js

+ 4 - 6
dist/inputmask/inputmask.js

@@ -1154,13 +1154,11 @@
             }, 0);
         }
         function initializeColorMask(input) {
-            var offset = input.getBoundingClientRect(), computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
+            var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
             colorMask = document.createElement("span"), colorMask.style.position = "absolute", 
-            colorMask.width = (offset.width ? offset.width : offset.right - offset.left) + "px", 
-            colorMask.height = (offset.height ? offset.height : offset.bottom - offset.top) + "px", 
-            colorMask.style.top = offset.top + parseInt(computedStyle.borderTopWidth) + "px", 
-            colorMask.style.left = offset.left + parseInt(computedStyle.borderLeftWidth) + "px", 
-            colorMask.style.zIndex = isNaN(computedStyle.zIndex) ? -1 : computedStyle.zIndex - 1, 
+            colorMask.style.top = input.clientTop + "px",
+            colorMask.style.left = input.clientLeft + parseInt(computedStyle.paddingLeft) + 'px',
+            colorMask.style.lineHeight = input.clientHeight + "px",
             colorMask.style.color = computedStyle.color, colorMask.style.fontSize = computedStyle.fontSize, 
             colorMask.style.fontStyle = computedStyle.fontStyle, colorMask.style.fontFamily = computedStyle.fontFamily, 
             colorMask.style.letterSpacing = computedStyle.letterSpacing, input.style.color = "transparent", 

+ 4 - 6
dist/jquery.inputmask.bundle.js

@@ -1152,13 +1152,11 @@
             }, 0);
         }
         function initializeColorMask(input) {
-            var offset = input.getBoundingClientRect(), computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
+            var computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
             colorMask = document.createElement("span"), colorMask.style.position = "absolute", 
-            colorMask.width = (offset.width ? offset.width : offset.right - offset.left) + "px", 
-            colorMask.height = (offset.height ? offset.height : offset.bottom - offset.top) + "px", 
-            colorMask.style.top = offset.top + parseInt(computedStyle.borderTopWidth) + "px", 
-            colorMask.style.left = offset.left + parseInt(computedStyle.borderLeftWidth) + "px", 
-            colorMask.style.zIndex = isNaN(computedStyle.zIndex) ? -1 : computedStyle.zIndex - 1, 
+            colorMask.style.top = input.clientTop + "px",
+            colorMask.style.left = input.clientLeft + parseInt(computedStyle.paddingLeft) + 'px',
+            colorMask.style.lineHeight = input.clientHeight + "px",
             colorMask.style.color = computedStyle.color, colorMask.style.fontSize = computedStyle.fontSize, 
             colorMask.style.fontStyle = computedStyle.fontStyle, colorMask.style.fontFamily = computedStyle.fontFamily, 
             colorMask.style.letterSpacing = computedStyle.letterSpacing, input.style.color = "transparent",