ZeroClipboard, Issue #149

CSS `zoom` weirdness: https://github.com/zeroclipboard/ZeroClipboard/issues/149

HTML

<h1>Test for <a href="https://github.com/zeroclipboard/ZeroClipboard/issues/149">ZeroClipboard, Issue #149</a></h1>
<div id="level_1">
    <div id="level_2">Test</div>
</div>
<div id="results"></div>

CSS

body {
    padding: 0px;
    margin: 0px;
}
#level_1 {
    padding: 25px;
    background-color: green;
    zoom: 0.5;
}
#level_2 {
    background-color: red;
    height: 30px;
}

JavaScript

"use strict";


var _getDOMObjectPosition = (function () {

    var _camelizeCssPropName = (function () {
        var matcherRegex = /\-([a-z])/g,
            replacerFn = function (match, group) {
                return group.toUpperCase();
            };
        return function (prop) {
            return prop.replace(matcherRegex, replacerFn);
        };
    })();

    var _getStyle = function (el, prop) {
        var value, camelProp, tagName, possiblePointers, i, len;
        if (window.getComputedStyle) {
            value = window.getComputedStyle(el, null).getPropertyValue(prop);
        } else {
            camelProp = _camelizeCssPropName(prop);
            if (el.currentStyle) {
                value = el.currentStyle[camelProp];
            } else {
                value = el.style[camelProp];
            }
        }
        if (prop === "cursor" && value === "auto" && el.tagName.toLowerCase() === "a") {
            value = "pointer";
        }
        if (prop === "zoom" && typeof value === "string") {
            if (value === "normal") {
                value = 1.0;
            }
            else if (value.slice(-1) === "%") {
                value = parseFloat(value) / 100.0;
            }
            // Oh, Safari....
            else if (value !== "reset") {
                value = parseFloat(value);
            }
        }
        return value;
    };

    var _getPageZoomFactor = function () {
        var rect, physicalWidth, logicalWidth,
        zoomFactor = 1.0;
        if (document.body.getBoundingClientRect) {
            rect = document.body.getBoundingClientRect();
            physicalWidth = rect.right - rect.left;
            logicalWidth = document.body.offsetWidth;
            zoomFactor = Math.round(physicalWidth / logicalWidth * 100) / 100;
        }
        return zoomFactor;
    };

    var _getCssZoomFactor = function (obj) {
        var elZoom,
            zoomFactor = 1.0,
            ignorePageZoom = false;
        while...