hasClass vs native (v4)

Revision 4 of this benchmark created by Steven on


Description

Test jQuery.hasClass vs native

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="test" class="my-test"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
hasClass()
$('#test').hasClass("my-test")
ready
native
$('#test')[0].className.match(/my-test/)
ready
native 2
$('#test')[0].className = "selected"
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.