jQuery#ready() (v3)

Revision 3 of this benchmark created on


Description

http://api.jquery.com/ready/

In addition to what’s being tested here, there’s $.ready too, but that one doesn’t actually do anything with functions, so it’s not a proper replacement for $(document).ready().

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="demo"></div>
<script>
var demo=document.getElementById('demo');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$(document).ready(fn)
$(document).ready(function() {
  demo.innerHTML='test1';
});
ready
$().ready(fn)
$().ready(function() {
   demo.innerHTML='test2';
});
ready
$(fn)
$(function() {
   demo.innerHTML='test3';
});
ready
$.fn.ready(fn)
$.fn.ready(function() {
   demo.innerHTML='test4';
});
ready
$.ready(fn)
$.ready(function() {
  demo.innerHTML='test5';
//can not run...
});
ready

Revisions

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