diff options
author | wout <wout@impinc.co.uk> | 2013-03-29 13:40:19 +0000 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-03-29 13:40:19 +0000 |
commit | f134e1cf3d06804f42c08e7e7985a5ab59a82c5c (patch) | |
tree | 55715ecce60fe1701d8c8723f0f056e579836c1b /src/doc.js | |
parent | 089816c84f8ae573cf558fe3b0242847f9eacbe9 (diff) | |
download | svg.js-f134e1cf3d06804f42c08e7e7985a5ab59a82c5c.tar.gz svg.js-f134e1cf3d06804f42c08e7e7985a5ab59a82c5c.zip |
Allow invocation of SVG() with an <svg> tag
Diffstat (limited to 'src/doc.js')
-rw-r--r-- | src/doc.js | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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 |