From 0bf19d02bd0c3c69e474378c62996b3003dcf2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 27 Jun 2013 17:43:24 -0700 Subject: [PATCH] Add asString parameter to exportSVG() methods. --- src/svg/SVGExport.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/svg/SVGExport.js b/src/svg/SVGExport.js index c653d032..38c7b096 100644 --- a/src/svg/SVGExport.js +++ b/src/svg/SVGExport.js @@ -466,7 +466,7 @@ new function() { definitions.svgs[type + '-' + item._id] = node; } - function exportDefinitions(node) { + function exportDefinitions(node, asString) { if (!definitions) return node; // We can only use svg nodes as defintion containers. Have the loop @@ -489,7 +489,7 @@ new function() { } // Clear definitions at the end of export definitions = null; - return svg; + return asString ? new XMLSerializer().serializeToString(svg) : svg; } function exportSVG(item) { @@ -509,8 +509,8 @@ new function() { * * @return {SVGSVGElement} the item converted to an SVG node */ - exportSVG: function() { - return exportDefinitions(exportSVG(this)); + exportSVG: function(asString) { + return exportDefinitions(exportSVG(this), asString); } }); @@ -523,7 +523,7 @@ new function() { * * @return {SVGSVGElement} the project converted to an SVG node */ - exportSVG: function() { + exportSVG: function(asString) { var layers = this.layers, size = this.view.getSize(), node = createElement('svg', { @@ -537,7 +537,7 @@ new function() { }); for (var i = 0, l = layers.length; i < l; i++) node.appendChild(exportSVG(layers[i])); - return exportDefinitions(node); + return exportDefinitions(node, asString); } }); };