useless-toggleClass

JavaScript performance comparison

Test case created by Gabriel Schulhof

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="item hasclass"></div>
<div class="item"></div>
<div class="item1 hasclass"></div>
<div class="item1 hasclass"></div>
<div id="dst">
</div>
<script>
window.items = $( ".item" ).remove();
window.items1 = $( ".item1" ).remove();
window.dst = $( "#dst" );

Preparation code output