jquery - empty vs html (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="foo"><div id="lol">foo bar foo bar foo bar foo bar</div></div>
<script>
  var foo = $('#foo'),
foo_inner = $('#lol');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
foo[0].innerHTML = '123';
ready
html
foo.html('123');
ready
empty
foo.empty().append('123');
ready
remove2
foo_inner.remove();
foo.append('123');
ready

Revisions

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