jQuery CSS vs Width vs Native Width

Benchmark created by Neil Craig 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");

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery CSS function
target.css("width", 100);
ready
jQuery Width function
target.width(100);
ready
Native inline styling
target[0].style.width = 100 + "px";
ready

Revisions

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