jQuery .on() vs .click() (v62)

Revision 62 of this benchmark created by Raunak on


Description

test jquery

Preparation HTML

<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>
    <a class="test"> click me</a>
    <a class="test"> click me</a>
<a class="test"> click me</a>
<a class="test"> click me</a>
<a class="test"> click me</a>
  </p>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
.on() with guard
$('.p').on('click', '.test', function() {
  alert('me aahe');
});
ready
.click()
$('.test').click(function() {
  alert('me aahe');
});
ready
.delegate()
$('p').delegate('click', '.test', function() {
  alert('me aahe');
});
ready
.on()
$('.test').on('click', function() {
  alert('me aahe');
});
ready

Revisions

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