hasClass (v25)

Revision 25 of this benchmark created on


Preparation HTML

<span class="class2">Test</span>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var span = $("span");

Test runner

Ready to run.

Testing in
TestOps/sec
hasclass
if (span.hasClass('class1') || span.hasClass('class2')){
console.log('hasClass')
}
ready
is
if (span.is('class1, .class2')){
console.log('is')
}
ready
length
if ($('span.class1').length || $('span.class2').length) {
console.log('length')
}
ready

Revisions

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