jQuery inline vs create with addClass (v250)

Revision 250 of this benchmark created on


Preparation HTML

<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
$('<div>').addClass('test')
$('<div>').addClass('test')
ready
$('<div class="test"></div>')
$('<div class="test"></div>')
ready
document.createElement
$(document.createElement('div')).addClass('test')
ready
$('<div>', {class: 'test'})
$('<div>', {class: 'test'})
ready
$('<div>'.prop('class', 'test')
$('<div>').prop('class', 'test')
ready
$('<div></div>').addClass('test')
$('<div></div>').addClass('test')
ready

Revisions

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