aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhilippe Bernard <philippe.bernard@gmail.com>2020-10-14 11:20:20 +0200
committerPhilippe Bernard <philippe.bernard@gmail.com>2020-10-14 11:20:20 +0200
commitc24eab6180fd86b2b5973d37d9a0099e1f50afbb (patch)
tree57fe74cb7a7849497e588c41831b29ffdca9aeb6 /src
parent99e176f76332b47a6c026dbd9dcf7742191b8b29 (diff)
downloadsvg.js-c24eab6180fd86b2b5973d37d9a0099e1f50afbb.tar.gz
svg.js-c24eab6180fd86b2b5973d37d9a0099e1f50afbb.zip
New paremeter assignNewIds for Dom.clone()
Diffstat (limited to 'src')
-rw-r--r--src/elements/Dom.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/elements/Dom.js b/src/elements/Dom.js
index 7c36078..508bbc2 100644
--- a/src/elements/Dom.js
+++ b/src/elements/Dom.js
@@ -67,12 +67,17 @@ export default class Dom extends EventTarget {
}
// Clone element
- clone (deep = true) {
+ clone (deep = true, assignNewIds = true) {
// write dom data to the dom so the clone can pickup the data
this.writeDataToDom()
- // clone element and assign new id
- return new this.constructor(assignNewId(this.node.cloneNode(deep)))
+ // clone element
+ var nodeClone = this.node.cloneNode(deep);
+ if (assignNewIds) {
+ // assign new id
+ nodeClone = assignNewId(nodeClone);
+ }
+ return new this.constructor(nodeClone)
}
// Iterates over all children and invokes a given block