jQuery CSS vs Width vs Native Width (v10)

Revision 10 of this benchmark created by LN on


Preparation HTML

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

Setup

var $target = $("#target");
  var target = document.getElementById("target");

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery CSS function
$target.css("width");
ready
jQuery Width function
$target.width();
ready
jquery inline styling
$target[0].style.width;
ready
native inline styling
target.style.width
ready
Native offsetWidth (IE8+)
target.offsetWidth
ready

Revisions

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