jQuery create markup

Benchmark created by Aurelio De Rosa on


Description

Benchmark to test what's the fastest way to create a new element in jQuery. The test compare 3 cases:

  • Passing only the opening tag
  • Passing the opening and closing tag
  • Passing an empty tag

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
$('<div>')
$('<div>')
ready
$('<div></div>')
$('<div></div>')
ready
$('<div />')
$('<div />')
ready

Revisions

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