diff options
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/dist/svg.js b/dist/svg.js index 66ed100..0ee1a1a 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,30 +1,39 @@ -/* svg.js v0.5-5-g7a2188b - svg element container fx event group arrange defs mask pattern gradient doc shape wrap rect ellipse line poly path image text nested sugar - svgjs.com/license */ +/* svg.js v0.5-6-g3ebe05f - svg element container fx event group arrange defs mask pattern gradient doc shape wrap rect ellipse line poly path image text nested sugar - svgjs.com/license */ (function() { this.svg = function(element) { - return new SVG.Doc(element); + if (SVG.supported) + return new SVG.Doc(element); }; // The main wrapping element this.SVG = { /* default namespaces */ - ns: 'http://www.w3.org/2000/svg', - xlink: 'http://www.w3.org/1999/xlink', + ns: 'http://www.w3.org/2000/svg' + , xlink: 'http://www.w3.org/1999/xlink' /* defs id sequence */ - did: 0, + , did: 0 // Method for element creation - create: function(element) { + , create: function(element) { return document.createElementNS(this.ns, element); - }, + } // Method for extending objects - extend: function(object, module) { + , extend: function(object, module) { for (var key in module) object.prototype[key] = module[key]; } }; + + // svg support test + SVG.supported = (function() { + return !! document.createElementNS && + !! document.createElementNS(SVG.ns,'svg').createSVGRect; + })(); + + if (!SVG.supported) return false; SVG.Element = function Element(node) { /* keep reference to the element node */ |