jQuery: css-display:none vs. hide (v14)

Revision 14 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="hide-me">hide me</div>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery :: display: none
$("#hide-me").css("display", "none");
$("#hide-me").css("display", "block");
ready
jQuery :: hide()
$("#hide-me").hide();
$("#hide-me").show();
ready
if style.display
if (document.getElementById("hide-me")!==null){
document.getElementById("hide-me").style.display = "none";
}
if (document.getElementById("hide-me")!==null){ document.getElementById("hide-me").style.display = "block";
}
ready
if null style.display
if (document.getElementById("hide-me")!==null)
document.getElementById("hide-me").style.display = "none";
if (document.getElementById("hide-me")!==null)
document.getElementById("hide-me").style.display = "block";
ready

Revisions

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