jQuery html() versus nice syntax (v2)

Revision 2 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
Nice syntax
$('#anotherDiv').empty();
$("<div>", {
    class: 'box',
    id: 'trololo'
}).append(
    $('<h2>', {
        class: 'header gradient-red'
    }),
    $('<div>', {
        class: 'body'  
    }).append(
        $('<div>', {
            class: 'queue' 
        }).append(
            $('<ul>', {
                class: 'queue-list',
                text: 'dummy-text' 
            })  
        ),
        $('<div>', { 
            class: 'time' 
        }) 
    )
).hide().appendTo('#anotherDiv')
ready
html() method
$("<div>", {
    class: 'box',
    id: 'trololo'
}).append('<h2 class="header gradient-red"></h2><div class="body"><div class="queue"><ul class="queue-list"></ul></div><div class="time"></div></div>').hide().appendTo('#anotherDiv')
ready

Revisions

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