in JSDOMParser.js [350:370]
appendChild(child) {
if (child.parentNode) {
child.remove();
}
var last = this.lastChild;
if (last) {
last.nextSibling = child;
}
child.previousSibling = last;
if (child.nodeType === Node.ELEMENT_NODE) {
child.previousElementSibling =
this.children[this.children.length - 1] || null;
this.children.push(child);
child.previousElementSibling &&
(child.previousElementSibling.nextElementSibling = child);
}
this.childNodes.push(child);
child.parentNode = this;
},