JQuery Append vs AppendTo (v5)

Revision 5 of this benchmark created by James Ganong on


Preparation HTML

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

Setup

var span = document.createElement("span");
    span.innerHTML = "hi";
    var $span = $(span);
    var $target = $("#container");

Teardown


    $target.html('');
  

Test runner

Ready to run.

Testing in
TestOps/sec
append()
$target.append($span.clone());
ready
appendTo()
$span.clone().appendTo($target);
ready

Revisions

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