Creating complex elements (v19)

Revision 19 of this benchmark created on


Preparation HTML

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

Setup

var clone = $("<div>").append( $("<table>").append('<tr>').append('<td>') );

Test runner

Ready to run.

Testing in
TestOps/sec
Using $().append()...
$("<div>").append( $("<table>").append('<tr>').append('<td>') );
ready
Using $(html)
$("<div><table><tr><td></td><td></td></tr></table></div>");
ready
Cloning
clone.clone()
ready
Using $( document.create/innerHtml )
var div = document.createElement("div");

div.innerHtml = "<table><tr><td></td><td></td></tr></table>";

$(div);
ready
Using $( document.create/insertAdjacentHTML )
var div = document.createElement("div");

div.insertAdjacentHTML('beforeend', "<table><tr><td></td><td></td></tr></table>");

$(div);
ready

Revisions

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