JS this.style.Width VS JQ .Width()

Benchmark created by Srele on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style>
#test_div{
width:100px;
border:1px solid black;
}
</style>
<div id="test_div"></div>
<script>
  obj = document.getElementById("test_div");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
obj.style.width
obj.style.width = 200 + 'px';
ready
$(obj).width()
$(obj).width(200);
ready

Revisions

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