From ee0b340bfeb2430767d4a2850413f864c42e5405 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Tue, 25 Jul 2017 14:19:49 +0200 Subject: add new default constructor (#714) --- src/doc.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/doc.js') diff --git a/src/doc.js b/src/doc.js index 667794d..d5bc30e 100644 --- a/src/doc.js +++ b/src/doc.js @@ -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() { -- cgit v1.2.3