hasClass in jQuery vs Prototype

Benchmark created by Jordan Boesch on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>$.noConflict();</script>
<script src="//ajax.googleapis.com/ajax/libs/prototype/1/prototype.js"></script>
<div id="el" class="found"></div>

Setup

var el1 = jQuery('#el'),
       el2 = $('el');

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery hasClass
el1.hasClass('found');
el1.hasClass('missing');
ready
Prototype hasClassName
el2.hasClassName('found');
el2.hasClassName('missing');
ready

Revisions

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

  • Revision 1: published by Jordan Boesch on
  • Revision 2: published on
  • Revision 3: published by Duncan Cheuk Kan Ma on
  • Revision 4: published on