hasClass in jQuery vs Prototype (v2)

Revision 2 of this benchmark created 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>

Setup

< div id = "el"
  class = "found" > < /div>
<script>
  Benchmark.prototype.setup = function() {
    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
Mootools
el2.hasClass('found');
el2.hasClass('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