Automatically move inner html in created node when inheriting from HTMLElement

This commit is contained in:
2024-10-20 18:29:48 +02:00
parent 301fc73687
commit 517263dd58
4 changed files with 17 additions and 17 deletions

View File

@ -43,7 +43,11 @@ export function inheritHtmlElement<K extends keyof HTMLElementTagNameMap>(tagNam
this.removeAttributeNode(attr);
this.node.setAttributeNode(attr);
}
// Atuomatically add node to DOM if autoAddNode is true or unspecified
this.node.innerHTML = this.innerHTML;
this.innerHTML = "";
// Automatically add node to DOM if autoAddNode is true or unspecified
if (autoAddNode === undefined || autoAddNode) {
this.appendChild(this.node);
}