From 84ace43af5adda090a58b55e38900e18164794c9 Mon Sep 17 00:00:00 2001 From: kerryliu Date: Thu, 27 Feb 2014 16:30:43 -0800 Subject: [PATCH] error proof against bad yui minification --- canvas2svg.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/canvas2svg.js b/canvas2svg.js index 1c48329..f4645af 100644 --- a/canvas2svg.js +++ b/canvas2svg.js @@ -1,4 +1,4 @@ -/*! +/*!! * Canvas 2 Svg v1.0.2 * A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document. * @@ -10,7 +10,8 @@ * * Copyright (c) 2014 Gliffy Inc. */ -(function() { + +;(function() { "use strict"; var STYLES, ctx, CanvasGradient, CanvasPattern, namedEntities; @@ -194,17 +195,19 @@ * height - height of your canvas (defaults to 500) * enableMirroring - enables canvas mirroring (get image data) (defaults to false) */ - ctx = function(options) { + ctx = function(o) { - var defaultOptions = { width:500, height:500, enableMirroring : false }; + var defaultOptions = { width:500, height:500, enableMirroring : false }, options; //keep support for this way of calling C2S: new C2S(width,height) if(arguments.length > 1) { options = defaultOptions; options.width = arguments[0]; options.height = arguments[1]; - } else if( !options ) { + } else if( !o ) { options = defaultOptions; + } else { + options = o; } if(!(this instanceof ctx)) { @@ -956,4 +959,4 @@ //add options for alternative namespace window.C2S = ctx; -}()); \ No newline at end of file +}());