diff --git a/src/svg/SvgImport.js b/src/svg/SvgImport.js index 1ad28fb4..b9e8d9ef 100644 --- a/src/svg/SvgImport.js +++ b/src/svg/SvgImport.js @@ -662,8 +662,12 @@ new function() { function onLoad(svg) { try { - var node = typeof svg === 'object' ? svg : new self.DOMParser() - .parseFromString(svg, 'image/svg+xml'); + var node = typeof svg === 'object' + ? svg + : new self.DOMParser().parseFromString( + svg, + 'image/svg+xml' + ); if (!node.nodeName) { node = null; throw new Error('Unsupported SVG source: ' + source); @@ -693,8 +697,10 @@ new function() { // Have the group not pass on all transformations to its children, // as this is how SVG works too. - // See if it's a string but handle markup separately - if (typeof source === 'string' && !/^.*\n \n\n' + var imported = paper.project.importSVG(svg); + equals(imported.children.length, 1); + equals(imported.firstChild, new Shape.Rectangle({ + size: [100, 100], + fillColor: 'red' + })); +}); + function importSVG(assert, url, message, options) { var done = assert.async(); project.importSVG(url, {