diff options
author | wout <wout@impinc.co.uk> | 2014-01-29 21:20:58 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-01-29 21:20:58 +0100 |
commit | 5b6736666dd85f8a063b87e6c6483ea47be4391c (patch) | |
tree | 139b35c98807ac36cad095af13ef45495958b78f /src/svg.js | |
parent | 9688054367938f1e9240c2d8572e94bb0149bc77 (diff) | |
download | svg.js-5b6736666dd85f8a063b87e6c6483ea47be4391c.tar.gz svg.js-5b6736666dd85f8a063b87e6c6483ea47be4391c.zip |
Added SVG.PathArray, updated data() and bumped to v1.0rc1
Diffstat (limited to 'src/svg.js')
-rwxr-xr-x | src/svg.js | 34 |
1 files changed, 32 insertions, 2 deletions
@@ -13,7 +13,8 @@ this.SVG = function(element) { } // Default namespaces -SVG.ns = 'http://www.w3.org/2000/svg' +SVG.ns = 'http://www.w3.org/2000/svg' +SVG.xmlns = 'http://www.w3.org/2000/xmlns/' SVG.xlink = 'http://www.w3.org/1999/xlink' // Element id sequence @@ -67,4 +68,33 @@ SVG.supported = (function() { !! document.createElementNS(SVG.ns,'svg').createSVGRect })() -if (!SVG.supported) return false
\ No newline at end of file +if (!SVG.supported) return false + +// Initialize parsing element +SVG.parser = (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) + + /* return parser object */ + return { + body: body + , doc: svg + , poly: poly + , path: path + } + +})()
\ No newline at end of file |