mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-13 11:58:04 +01:00
11 lines
347 B
JavaScript
11 lines
347 B
JavaScript
Document.prototype.replaceChildren ||= replaceChildren;
|
|
DocumentFragment.prototype.replaceChildren ||= replaceChildren;
|
|
Element.prototype.replaceChildren ||= replaceChildren;
|
|
|
|
function replaceChildren(...new_children) {
|
|
const { childNodes } = this;
|
|
while (childNodes.length) {
|
|
childNodes[0].remove();
|
|
}
|
|
this.append(...new_children);
|
|
}
|