Skip to content

Instantly share code, notes, and snippets.

@tgfjt
Last active August 29, 2015 14:07
Show Gist options
  • Save tgfjt/ce0d9e419036904649de to your computer and use it in GitHub Desktop.
Save tgfjt/ce0d9e419036904649de to your computer and use it in GitHub Desktop.
Zoom1.2// source http://jsbin.com/yayoge/14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Zoom1.2</title>
</head>
<body>
<h1>zoom</h1>
<pre><code>zoom: 1.1;</code></pre>
<div class="one"><div id="divTwo" class="two"></div></div>
</body>
</html>
body {
zoom: 1.2;
}
.one {
position: absolute;
border: 0;
width: 0;
height: 0;
top: 0;
left: -9999px;
}
.two {
display: inline;
margin: 0;
border: 0;
padding: 1px;
width: 1px;
zoom: 1;
}
var div = document.getElementById('divTwo');
alert('offsetWidth: ' + div.offsetWidth);
window.GCS = JSON.stringify(getComputedStyle(div, null), null, 2);
console.log(GCS);
@tgfjt
Copy link
Author

tgfjt commented Oct 14, 2014

Got div.offsetWidth === 3

In Case:

  • Safari
  • body { zoom: 1.1 (or 1.2 or 1.6) }

now detected as IE < 8
https://github.com/jquery/jquery/blob/master/test/data/jquery-1.9.1.js#L1519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment