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

JavaScript performance comparison

Revision 7 of this test case created

Preparation code

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

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

Preparation code output

Some paragraph

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
.live()
$('#content').live('click', $.noop);
pending…
.delegate()
$('#content').delegate('click', $.noop);
pending…
.delegate() on document
$(document).delegate('#content','click', $.noop);
pending…
.on()
$('#content').on('click', $.noop);
pending…
.on() on document
$(document).on('click', '#content', $.noop);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment