Test name | Executions per second |
---|---|
innerHTML | 220833.5 Ops/sec |
insertAdjacentHTML | 278060.0 Ops/sec |
const targetElem = document.createElement( 'DIV' );
targetElem.id = 'target';
document.body.appendChild( targetElem );
document.getElementById( 'target' ).innerHTML = `
<div>
<span>Child 4</span>
</div>
`;
document.getElementById( 'target' ).insertAdjacentHTML( 'beforeend', `
<div>
<span>Child 4</span>
</div>
` );