$(function(){}) vs. $(document).ready(function(){})

Benchmark created by @acazsouza on


Description

$(function(){}) vs. $(document).ready(function(){})

Preparation HTML

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

<div>
<span></span>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
$(function(){})
$(function() {
 $('span').text('teste1');
});
ready
$(document).ready(function(){})
$(document).ready(function() {
 $('span').text('teste1');
});
ready

Revisions

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

  • Revision 1: published by @acazsouza on