Test name | Executions per second |
---|---|
style | 547.0 Ops/sec |
getBoundingClientRect | 242.7 Ops/sec |
<div id="foo"></div>
var i = 5000;
while (i--) {
checkDisplay('foo');
}
function checkDisplay(id) {
let element = document.getElementById(id);
return element.style.width;
}
var i = 5000;
while (i--) {
checkDisplay('foo');
}
function checkDisplay(id) {
return document.getElementById(id).getBoundingClientRect().width === 0;
}