Class & id transfer when node swapping
This commit is contained in:
parent
93eea321a8
commit
7e679e3cc3
|
@ -16,6 +16,12 @@ export class SwapNode extends BaseNode {
|
||||||
if (this.hasReplaceNodes)
|
if (this.hasReplaceNodes)
|
||||||
return false;
|
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.linker(this.node, this.swapNode);
|
||||||
|
|
||||||
this.node.parentNode.replaceChild(this.swapNode, this.node);
|
this.node.parentNode.replaceChild(this.swapNode, this.node);
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="orep/canvas">
|
<script type="orep/canvas" class="test" id="render">
|
||||||
size = 400x300
|
size = 400x300
|
||||||
</script>
|
</script>
|
||||||
<script type="orep/canvas">
|
<script type="orep/canvas" class="test abc" id="stats">
|
||||||
size = 600x450
|
size = 600x450
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user