summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-02-02 21:54:17 +0100
committerwout <wout@impinc.co.uk>2014-02-02 21:54:17 +0100
commit3754d895e795253db045c0c4a5cdcb7c8cd4414d (patch)
tree41ef034dab3b390ee05d5cf60381a99d931af22a /src
parente1566105dcb10c55f669fb48e1eaf771b5232b44 (diff)
downloadsvg.js-3754d895e795253db045c0c4a5cdcb7c8cd4414d.tar.gz
svg.js-3754d895e795253db045c0c4a5cdcb7c8cd4414d.zip
Leaner parser
Diffstat (limited to 'src')
-rwxr-xr-xsrc/svg.js22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/svg.js b/src/svg.js
index 798f15d..b0f6ecd 100755
--- a/src/svg.js
+++ b/src/svg.js
@@ -69,29 +69,15 @@ SVG.get = function(id) {
SVG.prepare = function() {
/* select document body and create svg element*/
var body = document.getElementsByTagName('body')[0] || document.getElementsByTagName('svg')[0]
- , svg = SVG.create('svg')
- , poly = SVG.create('polygon')
- , path = SVG.create('path')
-
- /* make svg element presently invisible to ensure geometry */
- svg.setAttributeNS(SVG.xmlns, 'xmlns:xlink', SVG.xlink)
- svg.setAttribute('style', 'opacity:0;position:fixed;left:100%;top:100%')
- svg.setAttribute('width', '2')
- svg.setAttribute('height', '2')
-
- /* build node structure */
- body.appendChild(svg)
- svg.appendChild(poly)
- svg.appendChild(path)
+ , draw = new SVG.Doc(body).size(2, 2).style('opacity:0;position:fixed;left:100%;top:100%;')
/* create parser object */
SVG.parser = {
body: body
- , doc: svg
- , poly: poly
- , path: path
+ , draw: draw
+ , poly: draw.polygon().node
+ , path: draw.path().node
}
-
}
// svg support test