jQuery .css("height") vs .height() (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="test"><h1>abcabcabc</h1></div>

Setup

var h = 0;
    var item=$("div.test");

Test runner

Ready to run.

Testing in
TestOps/sec
.css("height")
item.css("height", "100px");
ready
.height()
item.height("100px");
 
ready
style.height
item[0].style.height = '100px';
ready
.css({height})
item.css({"height": "100px"});
ready

Revisions

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