Test name | Executions per second |
---|---|
getComputedStyle | 193.8 Ops/sec |
getBoundingClientRect | 360.3 Ops/sec |
<div id="foo"></div>
var i = 5000;
const node = document.getElementById('foo')
while (i--) {
checkDisplay('foo');
}
function checkDisplay(id) {
return parseFloat(window.getComputedStyle(node).height) > 0;
}
var i = 5000;
const node = document.getElementById('foo')
while (i--) {
checkDisplay('foo');
}
function checkDisplay(id) {
return node.getBoundingClientRect().height > 0;
}