style versus jquery css (v28)

Revision 28 of this benchmark created on


Preparation HTML

<div id="test" style="width: 400px; height: 200px; background-color: #ccc;">
</div>
<script src="//code.jquery.com/jquery-git2.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
Jquery css()
$('body').css('background-color', '#101010');
ready
Raw style
document.getElementsByTagName('body')[0].style.backgroundColor = "#101010";
ready
jQuery CSS multiple
$('body').css({
    'background-color': '#101010'
});
ready
Raw style
document.body.style.backgroundColor = "#101010";
ready
Hybrid
$('body')[0].style.backgroundColor = "#101010";
ready

Revisions

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