jQuery create markup (v5)

Revision 5 of this benchmark created 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://code.jquery.com/jquery-1.11.1.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
$('<div>')
$('<div>').on("click");
ready
$('<div></div>')
$('<div>').click();
ready

Revisions

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