Test case details

Preparation Code

<div id="test"></div>
var doc, test, parent;         doc = document;     test = doc.getElementById('test');         if (!test) {         test = doc.body.appendChild(doc.createElement('div'));         test.id = 'test';     }         parent = test.parentNode;
    var test;         test = doc.getElementById('test');         test.parentNode.innerHTML = '<div id="test"><\/div>';

Test cases

Test #1

parent.insertBefore(doc.createElement('div'), test);

Test #2

test.insertAdjacentHTML('BeforeBegin', '<div></div>');