aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-07-25 14:19:49 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-07-25 14:19:49 +0200
commitee0b340bfeb2430767d4a2850413f864c42e5405 (patch)
tree7cb4fe28d59643b2054edd6ae5c33ed8d2b33987 /src/doc.js
parentd6d389133409b315bc1b74752f58ef2647033bb9 (diff)
downloadsvg.js-ee0b340bfeb2430767d4a2850413f864c42e5405.tar.gz
svg.js-ee0b340bfeb2430767d4a2850413f864c42e5405.zip
add new default constructor (#714)
Diffstat (limited to 'src/doc.js')
-rw-r--r--src/doc.js7
1 files changed, 3 insertions, 4 deletions
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() {