summaryrefslogtreecommitdiffstats
path: root/src/parent.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-06-21 20:32:28 +0200
committerwout <wout@impinc.co.uk>2014-06-21 20:32:28 +0200
commit629a01b3bbf057eae7e0599433bbbcb28acd8587 (patch)
treec6ce43e4bb28e61885921d19ae99726ea93828c0 /src/parent.js
parent19b6fd4338246d1fd9ca4806e57c7aebcec63826 (diff)
downloadsvg.js-629a01b3bbf057eae7e0599433bbbcb28acd8587.tar.gz
svg.js-629a01b3bbf057eae7e0599433bbbcb28acd8587.zip
Various reference fixes
Diffstat (limited to 'src/parent.js')
-rwxr-xr-xsrc/parent.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/parent.js b/src/parent.js
index 55878ec..095120a 100755
--- a/src/parent.js
+++ b/src/parent.js
@@ -18,10 +18,10 @@ SVG.Parent = SVG.invent({
// Add given element at a position
, add: function(element, i) {
if (!this.has(element)) {
- /* define insertion index if none given */
+ // Define insertion index if none given
i = i == null ? this.children().length : i
- /* add element references */
+ // Add element references
this.node.insertBefore(element.node, this.node.childNodes[i] || null)
}
@@ -78,9 +78,10 @@ SVG.Parent = SVG.invent({
// Remove children
while(this.node.hasChildNodes())
this.node.removeChild(this.node.lastChild)
-
- // Remove defs cache reference
- delete this._defs
+
+ // Ensure new defs node
+ if (this instanceof SVG.Doc)
+ this.defs()
return this
}