summaryrefslogtreecommitdiffstats
path: root/src/doc.js
diff options
context:
space:
mode:
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() {