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

Revision 37 of this benchmark created by Bruno Bernardino on


Description

Updated to use latest jQuery

Preparation HTML

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

<div id="context">
<p>event tests</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() with Document
$(document).on('click', 'p', $.noop);
ready
.click()
$('p').click($.noop);
ready

Revisions

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