jquery css vs offsettop

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style>
#tester { position: absolute; top: -50px; }
</style>
<div id="tester">THE TESTER</div>
TOP: <div id="result"></div>

Teardown


    $("#result").text(topValue);
  

Test runner

Ready to run.

Testing in
TestOps/sec
JQuery CSS
var topValue = $("#tester").css("top");
ready
OffsetTop
var topValue = $("#tester")[0].offsetTop;
ready

Revisions

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