jQuery.fn.css — fastest calling pattern

Benchmark created by James Padolsey on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  var a = jQuery('<div/>').append(Array(100).join('<a></a>')).find('a');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
css({…})
a.css({
 color: 'red',
 padding: '5px',
 background: 'blue'
});
ready
css().css()
a.css('color', 'red').css('padding', '5px').css('background', 'blue');
ready

Revisions

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