From 1637a31ad7b181b9902f69a2b8cf03e6d2b6dd37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 3 Nov 2013 12:10:19 +0100 Subject: [PATCH] Allow #importSVG() to import from File objects too. --- src/svg/SVGImport.js | 61 +++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/src/svg/SVGImport.js b/src/svg/SVGImport.js index 45e9d39d..94b06f9e 100644 --- a/src/svg/SVGImport.js +++ b/src/svg/SVGImport.js @@ -490,29 +490,48 @@ new function() { return match && definitions[match[1]]; } - function importSVG(node, isRoot, options) { - if (!options) + function importSVG(source, isRoot, options) { + if (!source) + return null; + if (!options) { options = {}; - if (typeof node === 'string') { - // Check if the string does not represent SVG data, in which case - // it must be a url of a SVG to be loaded. - if (isRoot && node && !/^.*