summaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2016-05-13 14:03:10 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2016-05-13 14:03:10 +0200
commit3eb32097418087946c9340c82b0b6d4c5263967e (patch)
treed061c0cdb2a3af50e6e4351e913d2de9ad5e8d39 /src/element.js
parentc53de7ce090afdbd4959447e4fbd541d61b61cfb (diff)
downloadsvg.js-3eb32097418087946c9340c82b0b6d4c5263967e.tar.gz
svg.js-3eb32097418087946c9340c82b0b6d4c5263967e.zip
fixed bbox when element is not in the dom (#480), added parameter to `clone`
Diffstat (limited to 'src/element.js')
-rw-r--r--src/element.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/element.js b/src/element.js
index 552fd5b..2bf912a 100644
--- a/src/element.js
+++ b/src/element.js
@@ -61,12 +61,13 @@ SVG.Element = SVG.invent({
.height(new SVG.Number(p.height))
}
// Clone element
- , clone: function() {
+ , clone: function(parent) {
// clone element and assign new id
var clone = assignNewId(this.node.cloneNode(true))
- // insert the clone after myself
- this.after(clone)
+ // insert the clone in the given parent or after myself
+ if(parent) parent.add(clone)
+ else this.after(clone)
return clone
}