style versus jquery css (v2)

Revision 2 of this benchmark created by Jonathan on


Preparation HTML

<div id="test" style="width: 400px; height: 200px; background-color: #ccc;"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
Jquery css()
$('#test').css('background-color', '#000000');
ready
Native style
$('#test').style.backgroundColor = '#000000';
ready
Jquery css(), non css-selector
$('#test').css('backgroundColor', '#000000');
ready
Jquery css(), non css-selector, object
$('#test').css({
 backgroundColor: '#000000'
});
ready

Revisions

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