jQuery CSS vs Width vs Native Width (v3)

Revision 3 of this benchmark created on


Preparation HTML

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

Setup

var target = $("#target");

Test runner

Ready to run.

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

Revisions

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