.bind() vs .live() vs .delegate() vs .on() (v12)

Revision 12 of this benchmark created on


Description

The Difference Between jQuery’s .bind(), .live(), and .delegate()

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
  function handler() {
    $('p').text("CLICK !");
  }
</script>
<div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div><div>verylongcontents</div>
<div id="context">
<p>Event test</p>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
.on
$(document).on('click', 'p', handler);
ready
.on() in context
$('#context').on('click', 'p', handler);
ready

Revisions

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