jQuery scrollTop() vs dom scrollTop (v11)

Revision 11 of this benchmark created by Arend van Beelen jr. on


Description

Only measure .scrollTop(), not creation of the container.

Preparation HTML

<div id="container" style="height: 500px; overflow: auto">
  <div id="scrollme" style="height: 2000px;"></div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var container = document.getElementById("container");
    var $container = $("#container");
    $container.scrollTop(500);

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
$container.scrollTop();
ready
jQuery + dom method
$container[0].scrollTop;
ready
DOM Only
container.scrollTop;
ready

Revisions

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