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.
29 lines
842 B
29 lines
842 B
|
4 months ago
|
"use strict";
|
||
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
|
exports.replaceChildren = void 0;
|
||
|
|
var tslib_1 = require("tslib");
|
||
|
|
var replaceChildren = function (el, content) {
|
||
|
|
if (content == null) {
|
||
|
|
el.innerHTML = '';
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (el.replaceChildren) {
|
||
|
|
if (Array.isArray(content)) {
|
||
|
|
el.replaceChildren.apply(el, tslib_1.__spreadArray([], tslib_1.__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);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
};
|
||
|
|
exports.replaceChildren = replaceChildren;
|
||
|
|
//# sourceMappingURL=replace-children.js.map
|