jQuery body vs. document.body vs cached selector (v57)

Revision 57 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

Setup

var $body = document.body;

Test runner

Ready to run.

Testing in
TestOps/sec
$('body')
$('body').addClass('moo');
ready
$(document.body)
$(document.body).addClass('moo');
ready
$body
$body.addClass('moo');
ready

Revisions

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