Test name | Executions per second |
---|---|
Vanilla JS ID test | 1453422.2 Ops/sec |
Vanilla JS Class test | 1339877.2 Ops/sec |
jQuery ID Test | 1054802.4 Ops/sec |
jQuery Class Test | 404237.4 Ops/sec |
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<div class="test">blah</div>
<div id="test">blah</div>
document.querySelector('#test').classList.add('fuck');
document.querySelector('.test').classList.add('fuck');
$('#test').addClass('fuck');
$('.test').addClass('fuck');