append vs appendTo

Benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
append
var $input = $('<input/>', { type: 'hidden', disabled: true, value: 1, name: 'name' });
var $label = $('<div/>', { html:'html' }); 

var $activatedItem = $('<li/>', {
  "class": 'activatedItem'
}).append($input).append($label).append($('<div/>', {
  "class": 'class_deactivate'
})
//.click(function() { _this.deactivateItem($activatedItem, model.$associatedOption); })
);
ready
appendTo
var $input = $('<input/>', { type: 'hidden', disabled: true, value: 1, name: 'name' });
var $label = $('<div/>', { html:'html' }); 

var $activatedItem = $('<li/>', {
  "class": 'activatedItem'
});
var $mydiv = $('<div/>', {
  "class": 'class_deactivate'
});
//.click(function() { _this.deactivateItem($activatedItem, model.$associatedOption); })
$input.appendTo($activatedItem);
$label.appendTo($activatedItem);
$mydiv.appendTo($activatedItem);
ready

Revisions

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