Test name | Executions per second |
---|---|
getComputedStyle | 415.1 Ops/sec |
getBoundingClientRect | 275.4 Ops/sec |
<div id="foo"></div>
var i = 5000;
while (i--) {
checkDisplay('foo');
}
function checkDisplay(id) {
return window.getComputedStyle(document.getElementById(id), null).getPropertyValue("display") === "none";
}
var i = 5000;
while (i--) {
checkDisplay('foo');
}
function checkDisplay(id) {
return document.getElementById(id).getBoundingClientRect().width === 0;
}