jquery.css vs getComputedStyle

Benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div id="myDiv" style="border:1px solid black;width:10px;height:10px;padding:10px;">Wow</div>

Setup

var myDiv = document.getElementById('myDiv');
  var $myDiv = $(myDiv);

Test runner

Ready to run.

Testing in
TestOps/sec
getComputedStyle
var npaddingTop = getComputedStyle(myDiv).paddingTop;
ready
jquery.css
var jpaddingTop = $myDiv.css('padding-top');
ready

Revisions

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