jQuery body vs. document.body selector

JavaScript performance comparison

Revision 43 of this test case created by alaria rx

Preparation code

Wow that was unusual. I just wrote an extremely long comment but after I 
clicked submit my comment didn't show up. Grrrr... well I'm not writing all that 
over again. Anyhow, just wanted to say wonderful blog!
      
<script>
Benchmark.prototype.setup = function() {
  SH

};

Benchmark.prototype.teardown = function() {
  SH

};
</script>

Preparation code output

Wow that was unusual. I just wrote an extremely long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Anyhow, just wanted to say wonderful blog!

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
$(document.body)
Wow that was unusual. I just wrote an extremely long comment but after I 
clicked submit my comment didn't show up.
Grrrr... well I'm not writing all that over again. Anyhow,
just wanted to say wonderful blog!
pending…
$('body')
Wow that was unusual. I just wrote an extremely long comment but after I 
clicked submit my comment didn't show up. Grrrr...
well I'm not writing all that over again. Anyhow, just wanted to say wonderful blog!
pending…

Compare results of other browsers

Revisions

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

0 Comments

Wow that was unusual. I just wrote an extremely long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Anyhow, just wanted to say wonderful blog!