aboutsummaryrefslogtreecommitdiff
path: root/src/lib/dom.ts
blob: 2ab4de59bbcef5d90e586d7976f072e57ec922a7 (plain)
1
2
3
4
5
6
export function replaceChildren(parent: Element, ...newChildren: Element[]) {
  while (parent.lastChild) {
    parent.removeChild(parent.lastChild)
  }
  newChildren.forEach(c => parent.appendChild(c))
}