Class & id transfer when node swapping

This commit is contained in:
2020-04-21 15:14:04 +02:00
parent 93eea321a8
commit 7e679e3cc3
2 changed files with 8 additions and 2 deletions

View File

@@ -16,6 +16,12 @@ export class SwapNode extends BaseNode {
if (this.hasReplaceNodes)
return false;
// Copy id and classes to new node
if (this.node.id)
this.swapNode.id = this.node.id;
if (this.node.classList.length)
this.swapNode.classList = this.node.classList;
this.linker(this.node, this.swapNode);
this.node.parentNode.replaceChild(this.swapNode, this.node);