diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2016-04-15 19:53:58 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2016-04-15 19:53:58 +0200 |
commit | 30df220d96e813e0dab08a08ebb00ba9cfa25352 (patch) | |
tree | ef3cfd57acf3a25e1d5aa3dddfd1c7cda3cda924 /src | |
parent | bbea0c86882742f859bd133ad2c4a4d15dd9a172 (diff) | |
download | svg.js-30df220d96e813e0dab08a08ebb00ba9cfa25352.tar.gz svg.js-30df220d96e813e0dab08a08ebb00ba9cfa25352.zip |
fixed bug in `add()` and `SVG.Doc().create()`
Diffstat (limited to 'src')
-rw-r--r-- | src/doc.js | 13 | ||||
-rw-r--r-- | src/parent.js | 2 |
2 files changed, 8 insertions, 7 deletions
@@ -6,7 +6,7 @@ SVG.Doc = SVG.invent({ element = typeof element == 'string' ? document.getElementById(element) : element - + // If the target is an svg element, use that element as the main wrapper. // This allows svg.js to work with svg documents as well. if (element.nodeName == 'svg') { @@ -14,10 +14,11 @@ SVG.Doc = SVG.invent({ } else { this.constructor.call(this, SVG.create('svg')) element.appendChild(this.node) + this.size('100%', '100%') } - + // set svg element attributes and ensure defs node - this.namespace().size('100%', '100%').defs() + this.namespace().defs() } } @@ -58,7 +59,7 @@ SVG.Doc = SVG.invent({ // https://bugzilla.mozilla.org/show_bug.cgi?id=608812 , spof: function(spof) { var pos = this.node.getScreenCTM() - + if (pos) this .style('left', (-pos.e % 1) + 'px') @@ -66,7 +67,7 @@ SVG.Doc = SVG.invent({ return this } - + // Removes the doc from the DOM , remove: function() { if(this.parent()) { @@ -76,5 +77,5 @@ SVG.Doc = SVG.invent({ return this; } } - + }) diff --git a/src/parent.js b/src/parent.js index 86c7db8..30f7662 100644 --- a/src/parent.js +++ b/src/parent.js @@ -22,7 +22,7 @@ SVG.Parent = SVG.invent({ i = i == null ? this.children().length : i // add element references - this.node.insertBefore(element.node, this.node.childNodes[i] || null) + this.node.insertBefore(element.node, SVG.utils.filterSVGElements(this.node.childNodes)[i] || null) } return this |