jQuery create markup (v6)

Revision 6 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>')
$('button').on("click");
ready
$('<div></div>')
$('button').click();
ready

Revisions

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