jquery vs createElement vs cloning (v125)

Revision 125 of this benchmark created on


Description

Table cell (containing a class) jQuery creation with jQuery, document.createElement, jQuery.clone and element.cloneNode

Preparation HTML

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

Setup

var $toBeCloned = jQuery('<td class="Some"></td>'),
        toBeCloned = document.createElement('td');
    toBeCloned.setAttribute('class', 'Some');

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery(html)
var test = jQuery('<td class="Some"/>');
ready
document.createElement
var el = document.createElement('td'), test;
el.setAttribute('class', 'Some');
test = jQuery(el);
ready
jQuery.clone
var test = $toBeCloned.clone();
 
ready
element.cloneNode
var test = jQuery(toBeCloned.cloneNode(false));
ready

Revisions

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