export function replaceChildren(parent: Element, ...newChildren: Element[]) { while (parent.lastChild) { parent.removeChild(parent.lastChild) } newChildren.forEach(c => parent.appendChild(c)) }