spliting html

Benchmark created on


Preparation HTML

<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>

Setup

var splitter = document.createElement('div'),
    $plitter = $('<div>'),
    text = "<h1>Header</h1>\
  <p>this is a small paragraph</p>\
  <ul>\
      <li>list element 1.</li>\
      <li>list element 2.</li>\
      <li>list element 3. With a small update.</li>\
  </ul>";

Test runner

Ready to run.

Testing in
TestOps/sec
stock javascript
splitter.innerHTML = text;

var parts = splitter.children,
  part = parts[0].innerHTML;
ready
jquery
var elements = $(text).map(function() {
    return $plitter.html(this).html();  // Basically `.outerHTML()`
});
ready

Revisions

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