jQuery hide or display none (v3)

Revision 3 of this benchmark created by Fergal on


Description

Cf. jQuery source code : https://github.com/jquery/jquery/blob/4b39a8289031bb7de25e9f018d9fd8235a35ec49/src/css.js

Preparation HTML

<div id="test">Test</div>

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

Test runner

Ready to run.

Testing in
TestOps/sec
Jquery hide
$("#test").hide().show();
ready
Jquery display none
$("#test").css('display', 'none').show();
ready
Vanilla JS
document.getElementById('test').style.display = 'none';
document.getElementById('test').style.display = 'block';
ready
Mix
$("#test")[0].style.display = 'none';
$("#test")[0].style.display = 'block';
ready

Revisions

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

  • Revision 1: published by MathRobin on
  • Revision 3: published by Fergal on