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

Revision 12 of this benchmark created by Jonathan 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);

$("p", '#context').trigger("click");
ready
.live() with context
$('p', $('#context')).live('click', $.noop);

$("p", '#context').trigger("click");
ready
.delegate()
$('#context').delegate('p', 'click', $.noop);

$("p", '#context').trigger("click");
ready
.delegate() on document
$(document).delegate('p', 'click', $.noop);

$("p", '#context').trigger("click");
ready
.on()
$('#context').on('click', 'p', $.noop);

$("p", '#context').trigger("click");
ready
.on() on document
$(document).on('click', 'p', $.noop);

$("p", '#context').trigger("click");

 
ready

Revisions

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