jquery css() versus simple javascript style change

Benchmark created on


Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<div id="bP4" style="left:10px; top:10px;"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
css()
$("#bP4").css({
 "top": "20px",
 "left": "40px"
});
ready
ordinary js
obj = document.getElementById('bP4');
obj.style.top = "20px";
obj.style.left = "40px";
ready

Revisions

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