aprog 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/html.js +13 -0
package/package.json
CHANGED
package/src/html.js
CHANGED
|
@@ -68,6 +68,18 @@ export function repeatHTMLElementPrototype() {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
export function replaceChildrenHTMLElementPrototype() {
|
|
72
|
+
if (!HTMLElement.prototype.replaceChildren) {
|
|
73
|
+
HTMLElement.prototype.replaceChildren = function (newElement) {
|
|
74
|
+
if (!(newElement instanceof HTMLElement)) {
|
|
75
|
+
throw new Error('Argument must be an HTMLElement');
|
|
76
|
+
}
|
|
77
|
+
this.innerHTML = null;
|
|
78
|
+
this.appendChild(HTMLElement);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
71
83
|
pushHTMLElementPrototype();
|
|
72
84
|
pushAfterHTMLElementPrototype();
|
|
73
85
|
pushBeforeHTMLElementPrototype();
|
|
@@ -75,3 +87,4 @@ dataHTMLElementPrototype();
|
|
|
75
87
|
toKebabCaseStringPrototype();
|
|
76
88
|
toSnakeCaseStringPrototype();
|
|
77
89
|
repeatHTMLElementPrototype();
|
|
90
|
+
replaceChildrenHTMLElementPrototype();
|