Vanilla JS innerHTML vs jQuery html() (v7)

Revision 7 of this benchmark created by Andrew on


Preparation HTML

<div id="js-element">initial content</div>

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

Setup

var element = document.getElementById('js-element');

Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
element.innerHTML = '<a href="http://www.google.com">X</a>';
ready
jQuery html()
$(element).html('<a href="http://www.google.com">X</a>');
ready

Revisions

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

  • Revision 1: published by André Ruffert on
  • Revision 3: published by Martín Acosta on
  • Revision 4: published on
  • Revision 5: published by Ben on
  • Revision 6: published by Andrew on
  • Revision 7: published by Andrew on