jQuery elements constructor (v15)

Revision 15 of this benchmark created by Alexander on


Description

Test different ways to create element with attributes.

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
Inline attributes
$('<div id="test" class="foo">')
ready
Attributes object
$('<div>', {'id': 'test', 'class': 'foo'})
ready
Add class separately
$('<div>', {'id': 'test'}).addClass('foo');
ready

Revisions

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