"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.appendChild = appendChild;
exports.insertBefore = insertBefore;
exports.insertBeforeAt = insertBeforeAt;
exports.removeChild = removeChild;
exports.prepend = prepend;
exports.removeChildren = removeChildren;
exports.insertAt = insertAt;
function appendChild(node, newChild) {
    return node.appendChild(newChild);
}
function insertBefore(node, newChild, refChild) {
    return node.insertBefore(newChild, refChild);
}
function insertBeforeAt(node, newChild, at) {
    const nextChild = node.childNodes.item(at);
    return insertBefore(node, newChild, nextChild);
}
function removeChild(node, oldChild) {
    return node.removeChild(oldChild);
}
function prepend(node, newChild) {
    if (node instanceof Text) {
        return;
    }
    return node.prepend(newChild);
}
function removeChildren(element) {
    while (element.firstChild) {
        element.removeChild(element.lastChild);
    }
}
function insertAt(node, newChild, at) {
    const currentChild = node.childNodes.item(at);
    if (currentChild) {
        return insertBefore(node, newChild, currentChild);
    }
    else {
        return appendChild(node, newChild);
    }
}
//# sourceMappingURL=element.js.map