height vs offsetHeight vs css height (v2)

Revision 2 of this benchmark created by zkniebel on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div id="foo" style="height:666px;width:300px;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa neque tempore eligendi. Facilis inventore rem cum doloribus adipisci deleniti, fugiat quos? Possimus, perferendis deserunt, deleniti enim amet officia incidunt quas.
<div>

Setup

var $foo = $("#foo");

Test runner

Ready to run.

Testing in
TestOps/sec
.height()
$foo.height()
ready
.offsetHeight [read-only]
$foo[0].offsetHeight
ready
.css("height")
$foo.css("height")
ready
.style.height
$foo[0].style.height
ready

Revisions

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