hide() vs css()

Benchmark created by Anders Ringqvist on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="foo">
</div>
<script>
  var $foo = $('#foo');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.hide()
$foo.hide();
ready
.css('display', 'none')
$foo.css('display', 'none');
ready
.css({'display': 'none'})
$foo.css({
  'display': 'none'
});
ready
.css({display: 'none'})
$foo.css({
  display: 'none'
});
ready

Revisions

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

  • Revision 1: published by Anders Ringqvist on