summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2016-04-02 00:38:27 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2016-04-02 00:38:27 +0200
commit528637eb862877ca60cfa311eb54c6384566f831 (patch)
treea4d2e239466a83edb8ff4fb8751b6b80c445656f /src
parente059cf7f0a9b6325baad21c4fb47f0ec632088ca (diff)
downloadsvg.js-528637eb862877ca60cfa311eb54c6384566f831.tar.gz
svg.js-528637eb862877ca60cfa311eb54c6384566f831.zip
doublecheck SVG.parser, use svg element which is not in the dom (#471)
Diffstat (limited to 'src')
-rw-r--r--src/matrix.js2
-rw-r--r--src/point.js2
-rw-r--r--src/svg.js14
3 files changed, 14 insertions, 4 deletions
diff --git a/src/matrix.js b/src/matrix.js
index e727b2f..37bd860 100644
--- a/src/matrix.js
+++ b/src/matrix.js
@@ -156,7 +156,7 @@ SVG.Matrix = SVG.invent({
// Convert to native SVGMatrix
, native: function() {
// create new matrix
- var matrix = SVG.parser.draw.node.createSVGMatrix()
+ var matrix = SVG.parser.native.createSVGMatrix()
// update with current values
for (var i = abcdef.length - 1; i >= 0; i--)
diff --git a/src/point.js b/src/point.js
index ba7bd8f..8d1dae9 100644
--- a/src/point.js
+++ b/src/point.js
@@ -45,7 +45,7 @@ SVG.Point = SVG.invent({
// Convert to native SVGPoint
, native: function() {
// create new point
- var point = SVG.parser.draw.node.createSVGPoint()
+ var point = SVG.parser.native.createSVGPoint()
// update with current values
point.x = this.x
diff --git a/src/svg.js b/src/svg.js
index 4cdf364..1175a62 100644
--- a/src/svg.js
+++ b/src/svg.js
@@ -1,7 +1,12 @@
// The main wrapping element
var SVG = this.SVG = function(element) {
if (SVG.supported) {
- return new SVG.Doc(element)
+ element = new SVG.Doc(element)
+
+ if(!SVG.parser.draw)
+ SVG.prepare()
+
+ return element
}
}
@@ -133,10 +138,15 @@ SVG.prepare = function() {
, draw: draw.style('opacity:0;position:fixed;left:100%;top:100%;overflow:hidden')
, poly: draw.polyline().node
, path: draw.path().node
+ , native: SVG.create('svg')
}
}
+SVG.parser = {
+ native: SVG.create('svg')
+}
+
document.addEventListener('DOMContentLoaded', function() {
- if(!SVG.parser)
+ if(!SVG.parser.draw)
SVG.prepare()
}, false)