Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
Chrome 60
Windows
Other
7 years ago
Test name Executions per second
parse() 152072.4 Ops/sec
innerHTML 193042.0 Ops/sec
jQuery 75492.5 Ops/sec
HTML Preparation code:
AخA
 
1
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/core.js"></script>
2
<div id="demo"></div
Script Preparation code:
 
  var html = ""
  
  for(var i = 0; i++; i < 1000){
     html += `<ol>
    <li>a</li>
    <li>b</li>
  </ol>
  <ol>
    <li>c</li>
    <li>d</li>
  </ol>`;
  }
  
  var demo = document.querySelector("#demo")
  var range = document.createRange();
  var parse = range.createContextualFragment.bind(range);
Tests:
  • parse()

     
    demo.appendChild(parse(html));
    document.querySelector("#demo").innerHTML = ""
  • innerHTML

     
    demo.innerHTML = html;
    document.querySelector("#demo").innerHTML = ""
  • jQuery

     
    demo.append($(html)[0]);
    document.querySelector("#demo").innerHTML = ""