summaryrefslogtreecommitdiffstats
path: root/src/doc.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc.js')
-rw-r--r--src/doc.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/doc.js b/src/doc.js
index 2e2fd0a..cedaefe 100644
--- a/src/doc.js
+++ b/src/doc.js
@@ -2,21 +2,23 @@
//
SVG.Doc = function(element) {
- this.constructor.call(this, SVG.create('svg'))
-
/* ensure the presence of a html element */
this.parent = typeof element == 'string' ?
document.getElementById(element) :
element
/* set svg element attributes and create the <defs> node */
+ this.constructor
+ .call(this, this.parent.nodeName == 'svg' ? this.parent : SVG.create('svg'))
+
this
.attr({ xmlns: SVG.ns, version: '1.1', width: '100%', height: '100%' })
.attr('xlink', SVG.xlink, SVG.ns)
.defs()
/* ensure correct rendering for safari */
- this.stage()
+ if (this.parent.nodeName != 'svg')
+ this.stage()
}
// Inherits from SVG.Container