insertAdjacentHTML 4 types(BeforeBegin, AfterBegin, BeforeEnd, AfterEnd)

Benchmark created by syoichi on


Preparation HTML

<div id="test"></div>

Setup

var doc, test;
    
    doc = document;
    test = doc.getElementById('test');
    
    if (!test) {
        test = doc.body.appendChild(doc.createElement('div'));
        test.id = 'test';
    }

Test runner

Ready to run.

Testing in
TestOps/sec
BeforeBegin
test.insertAdjacentHTML('BeforeBegin', '<div></div>');
ready
AfterBegin
test.insertAdjacentHTML('AfterBegin', '<div></div>');
ready
BeforeEnd
test.insertAdjacentHTML('BeforeEnd', '<div></div>');
ready
AfterEnd
test.insertAdjacentHTML('AfterEnd', '<div></div>');
ready

Revisions

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

  • Revision 1: published by syoichi on