live-vs-on
JavaScript performance comparison
Info
Comparison of jQuery live() and on() methods when binding to the same event on multiple elements.
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
<li>five</li>
<li>six</li>
<li>seven</li>
<li>eight</li>
<li>nine</li>
<li>ten</li>
</ul>
<script>
Benchmark.prototype.setup = function() {
var update = function(e) {
$(this).html('foo');
}
};
</script>
Preparation code output
- one
- two
- three
- four
- five
- six
- seven
- eight
- nine
- ten
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
live() |
|
pending… |
on |
|
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:
- Revision 1: published by Antti Ahti
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published
- Revision 6: published
- Revision 7: published
- Revision 8: published
- Revision 9: published
- Revision 10: published
- Revision 11: published by Map or each
- Revision 12: published
- Revision 13: published
- Revision 14: published by Dan
- Revision 15: published
- Revision 16: published by AntonyRaj
- Revision 17: published by AntonyRaj
1 comment
Thanks for this!