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