jQuery elements creation vs. native elements creation

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

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

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jQuery elements creation
var $tr_node = $('<tr>');
$('<td>', {
  'class': 'dataList'
}).appendTo($tr_node);
pending…
Native elements creation
var tr_node = document.createElement('tr');
var td_node = document.createElement('td');
td_node.class = 'dataList';
tr_node.appendChild(td_node);
pending…
jQuery and native hybrid
var $tr_node = $(document.createElement('tr'));
var $td_node = $(document.createElement('td'), {
  'class': 'dataList'
});
$tr_node.append($td_node);
pending…
Document fragment
var tr_node = document.createElement('tr');
var td_nodes = document.createDocumentFragment();
var td_node = document.createElement('td');
td_node.class = 'dataList';
td_nodes.appendChild(td_node);
tr_node.appendChild(td_nodes);
pending…
innerHTML
var tr_node = document.createElement('tr');
tr_node.innerHTML = '<td class="dataList"></td>';
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