Test name | Executions per second |
---|---|
getElementById | 3597467.5 Ops/sec |
querySelector | 2132915.8 Ops/sec |
<div id="testElement"></div>
var el = document.getElementById('testElement');
var className = el.className;
var el = document.querySelector('#testElement');
var className = el.className;