From 77b142bec4479a6a319395ba9071f6541fd5330d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 29 Oct 2013 16:41:16 +0100 Subject: [PATCH] Allow the SVGExport code to assume that the option object is always defined. --- src/svg/SVGExport.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/svg/SVGExport.js b/src/svg/SVGExport.js index cb743949..61da4c23 100644 --- a/src/svg/SVGExport.js +++ b/src/svg/SVGExport.js @@ -365,7 +365,7 @@ new function() { } // Clear definitions at the end of export definitions = null; - return options && options.asString + return options.asString ? new XMLSerializer().serializeToString(svg) : svg; } @@ -379,21 +379,22 @@ new function() { } function setOptions(options) { - formatter = options && options.precision - ? new Formatter(options.precision) - : Formatter.instance; + if (!options) + options = {}; + formatter = new Formatter(options.precision); + return options; } Item.inject({ exportSVG: function(options) { - setOptions(options); + options = setOptions(options); return exportDefinitions(exportSVG(this), options); } }); Project.inject({ exportSVG: function(options) { - setOptions(options); + options = setOptions(options); var layers = this.layers, size = this.view.getSize(), node = createElement('svg', {