jQuery scrollTop() vs dom scrollTop (v7)

Revision 7 of this benchmark created on


Preparation HTML

<div id="container" style="height: 500px; overflow: auto">
  <div id="scrollme" style="height: 2000px;"></div>
</div>
<script src="//code.jquery.com/jquery-2.1.0.js"></script>

Setup

$("#container").scrollTop(500);

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
var container = $("#container");
container.scrollTop();
ready
jQuery + dom method
var container = $("#container");
container[0].scrollTop;
ready
DOM Only
var container = document.getElementById("container");
container.scrollTop;
ready

Revisions

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