.bind() vs .live() vs .delegate() vs .on()
JavaScript performance comparison
Info
The Difference Between jQuery’s .bind(), .live(), and .delegate()
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
function handler() {
$('p').text("CLICK !");
}
</script>
<p>Event</p>
Preparation code output
Event
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
.bind |
|
pending… |
.live() in document |
|
pending… |
.live() in a |
|
pending… |
.delegate |
|
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 Rochas and last updated
- Revision 2: published
- Revision 3: published by Rochas
- Revision 4: published by Rochas
- Revision 5: published by Rochas
- Revision 6: published
- Revision 7: published
- Revision 8: published
1 comment
Expected results ! "on" is binded on document, while for others, we must first find all "p" elements.