You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
694 B
25 lines
694 B
import { __read, __spreadArray } from "tslib";
|
|
export var replaceChildren = function (el, content) {
|
|
if (content == null) {
|
|
el.innerHTML = '';
|
|
return;
|
|
}
|
|
if (el.replaceChildren) {
|
|
if (Array.isArray(content)) {
|
|
el.replaceChildren.apply(el, __spreadArray([], __read(content), false));
|
|
}
|
|
else {
|
|
el.replaceChildren(content);
|
|
}
|
|
}
|
|
else {
|
|
el.innerHTML = '';
|
|
if (Array.isArray(content)) {
|
|
content.forEach(function (child) { return el.appendChild(child); });
|
|
}
|
|
else {
|
|
el.appendChild(content);
|
|
}
|
|
}
|
|
};
|
|
//# sourceMappingURL=replace-children.js.map
|