diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-07-25 14:19:49 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-07-25 14:19:49 +0200 |
commit | ee0b340bfeb2430767d4a2850413f864c42e5405 (patch) | |
tree | 7cb4fe28d59643b2054edd6ae5c33ed8d2b33987 /src/doc.js | |
parent | d6d389133409b315bc1b74752f58ef2647033bb9 (diff) | |
download | svg.js-ee0b340bfeb2430767d4a2850413f864c42e5405.tar.gz svg.js-ee0b340bfeb2430767d4a2850413f864c42e5405.zip |
add new default constructor (#714)
Diffstat (limited to 'src/doc.js')
-rw-r--r-- | src/doc.js | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,8 +1,7 @@ SVG.Doc = SVG.invent({ // Initialize node - create: function(element) { - element = element || SVG.create('svg') - this.constructor.call(this, element) + create: function(node) { + this.constructor.call(this, node || SVG.create('svg')) // set svg element attributes and ensure defs node this.namespace().defs() @@ -22,7 +21,7 @@ SVG.Doc = SVG.invent({ } // Creates and returns defs element , defs: function() { - return this.put(this.node.getElementsByTagName('defs')[0] || new SVG.Defs) + return (this.node.getElementsByTagName('defs')[0] || this.put(new SVG.Defs).node).instance } // custom parent method , parent: function() { |