jQuery CSS vs Width vs Native Width (v6)

Revision 6 of this benchmark created on


Preparation HTML

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

Setup

var target = $("#target");

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery CSS function
target.css("width");
ready
jQuery Width function
target.width();
ready
Native inline styling
target[0].style.width;
ready
Native, getComputedStyle
parseInt(window.getComputedStyle(target[0]).width, 10);
ready

Revisions

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