jQuery element creation

JavaScript performance comparison

Revision 22 of this test case created

Preparation code

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

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
With trailing slash
$('<div/>', {'id': 'bum', 'class': 'more-bum'});
pending…
Without trailing slash
$('<div>', {'id': 'bum', 'class': 'more-bum'});
pending…
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>');
pending…
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);
pending…
just a string
$('<div id="bum" class="more-bum"></div>');
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment