jQuery element creation (v22)

Revision 22 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
With trailing slash
$('<div/>', {'id': 'bum', 'class': 'more-bum'});
ready
Without trailing slash
$('<div>', {'id': 'bum', 'class': 'more-bum'});
ready
Opening and closing tags
$('<div class="' + 'bum' + '"><div data-overlay-id="test" class="' +'cheese' + '">Test<a class="close" data-overlay-action="close">close</a></div></div>');
ready
document.createElement
var t = $(document.createElement('div'), {'class': 'bum'});
var e = $(document.createElement('div'), {'data-overlay-id': 'test', text: 'Test'});
var s = $(document.createElement('a'), {'class': 'close', 'data-overlay-action': 'close', text: 'close'});

e.append(s);
t.append(e);
ready
just a string
$('<div id="bum" class="more-bum"></div>');
ready

Revisions

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