diff options
author | wout <wout@impinc.co.uk> | 2014-02-02 21:54:17 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-02-02 21:54:17 +0100 |
commit | 3754d895e795253db045c0c4a5cdcb7c8cd4414d (patch) | |
tree | 41ef034dab3b390ee05d5cf60381a99d931af22a /src | |
parent | e1566105dcb10c55f669fb48e1eaf771b5232b44 (diff) | |
download | svg.js-3754d895e795253db045c0c4a5cdcb7c8cd4414d.tar.gz svg.js-3754d895e795253db045c0c4a5cdcb7c8cd4414d.zip |
Leaner parser
Diffstat (limited to 'src')
-rwxr-xr-x | src/svg.js | 22 |
1 files changed, 4 insertions, 18 deletions
@@ -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 |