$.css() v. style.property (v10)

Revision 10 of this benchmark created on


Description

Go vanilla js! Ps: if you cache dom node with jquery method just do the same with native methodes. Of course natives are way faster...

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<div id="testme">
</div>
<script>
  $testme = $('#testme');
  testme = document.getElementById('testme');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$.css()
$testme.css('left', 300);
ready
style.property
$testme[0].style.left = '300px';
ready
$.attr()
$testme.attr('style', 'left: 300px;');
ready
full native setAttribute
testme.setAttribute('style', 'left: 300px;');
ready
full native style.left
testme.style.left = "300px";
ready

Revisions

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