multiple document ready bindings

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="div1"><a href="#">item 1</a></div>
<div id="div2"><a href="#">item 2</a></div>
<div id="div3"><a href="#">item 3</a></div>

Test runner

Ready to run.

Testing in
TestOps/sec
single
$(document).ready(function() {
 $('#div1').click(function() {
  alert('clicked div 1');
 });
 $('#div2').click(function() {
  alert('clicked div 2');
 });
 $('#div3').click(function() {
  alert('clicked div 3');
 });
});
ready
multiple
$(document).ready(function() {
 $('#div1').click(function() {
  alert('clicked div 1');
 });
});
$(document).ready(function() {
 $('#div2').click(function() {
  alert('clicked div 2');
 });
});
$(document).ready(function() {
 $('#div3').click(function() {
  alert('clicked div 3');
 });
});
ready

Revisions

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