jQuery ready vs DOMContentLoaded (v9)

Revision 9 of this benchmark created on


Preparation HTML

<div id="t">
<p>
<a href="#">てすと</a>
</p>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
DOMContentLoaded
	function domContentLoaded() {  
	  $('#t').find('p').find('a').text('change!!');
	  alert('DOMContentLoaded');
	}

	document.addEventListener('DOMContentLoaded', domContentLoaded);
ready
jQuery ready
	function domContentLoaded() {  
	  $('#t').find('p').find('a').text('change!!');
	  alert('DOMContentLoaded');
	}

	$.ready(function() {
	  domContentLoaded();
	});
ready

Revisions

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