mootools element append vs innerHTML append (v9)

Revision 9 of this benchmark created by Jason Johnson on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js"></script>
<div id="test"></div>
<script>
  var nd = $('test');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
mootools inject
new Element('span', {
 'html': 'a'
}).injectInside(nd);
new Element('span', {
 'html': 'b'
}).injectInside(nd);
new Element('span', {
 'html': 'c'
}).injectInside(nd);
new Element('span', {
 'html': 'd'
}).injectInside(nd);
ready
innerhtml append
nd.innerHTML = nd.innerHTML + '<span>e</span><span>f</span><span>g</span><span>h</span>';
ready
innerhtml append 2
nd.innerHTML += '<span>i</span><span>j</span><span>k</span><span>l</span>';
ready
mootools inject 2
new Element('span', {
 'html': '<span>m</span><span>n</span><span>o</span><span>p</span>'
}).injectInside(nd);
ready
mootools adopt
var n1 = new Element('span', {
 'html': '<span>q</span><span>r</span><span>s</span><span>t</span>'
});
var elems = n1.getChildren();
nd.adopt(elems);
ready
innerHTML
nd.innerHTML = '<span>z</span>';
ready
mootools empty adopt
var n1 = new Element('span', {
 'html': '<span>q</span><span>r</span><span>s</span><span>t</span>'
});
var elems = n1.getChildren();
nd.empty();
nd.adopt(elems);
ready

Revisions

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

  • Revision 9: published by Jason Johnson on