jQuery 1.7.1 .click() vs .bind() vs .live() vs .delegate() vs .on() (v41)

Revision 41 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<div id="context">
<p>Some paragraph</p>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
.live()
$('p').live('click', $.noop);
ready
.live() with context
$('p', $('#context')).live('click', $.noop);
ready
.delegate()
$('#context').delegate('p', 'click', $.noop);
ready
.delegate() on document
$(document).delegate('p', 'click', $.noop);
ready
.on()
$('#context').on('click', 'p', $.noop);
ready
.on() on document (p)
$(document).on('click', 'p', $.noop);
ready
.bind()
$('p').bind('click', $.noop);
ready
.click()
$('p').click($.noop);
ready
.on() on p
$('p').on('click', $.noop);
ready
.on() on body
$('body').on('click', 'p', $.noop);
ready

Revisions

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