adding dom elements jquery vs mootools vs dojo to body

JavaScript performance comparison

Test case created by Liad Magen

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js">
</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js">
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
dojo
dojo.create('div', {
  innerHTML: 'This is a new element',
  id: 'myElement'
}, dojo.body());
pending…
jquery
jQuery('<div id="myElement">This is a new element</div>').appendTo('body');
pending…
mootools
new Element('div', {
  id: 'myElement',
  text: 'This is a new element'
}).inject(document.body);
pending…
dojo 1.7 AMD
require(["dojo/dom-construct", "dojo/_base/window"], function(domConstruct, win) {
  var node = domConstruct.create("div", {
    innerHTML: "TARGET"
  }, win.body());
})
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. Here’s a list of current revisions for this page:

0 comments

Add a comment