jQuery .on() vs .click()

JavaScript performance comparison

Revision 78 of this test case created

Info

test jquery

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<div class="context">
  <p class="p">
    <a class="#test"> click me</a>
  </p>
</div>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
.on() with guard
$('.context').on('click', '.test', function() {
  alert('me aahe');
});
pending…
.click()
$('.context .test').click(function() {
  alert('me aahe');
});
pending…
.delegate()
$('.context .test').delegate('click', function() {
  alert('me aahe');
});
pending…
.on()
$('.context .test').on('click', function() {
  alert('me aahe');
});
pending…
.click() with filter
$('.context').filter('.test').click(function() {
  alert('me aahe');
});
pending…
.on() with filter
$('.context').filter('.test').on('click', function() {
  alert('me aahe');
});
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment