From cd7bea618341361cd563406d2141c7cd40790311 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Wed, 27 Aug 2014 14:17:33 +0200 Subject: [PATCH] Update parser.js Better than getting 0px width and height. Specs say that when they are missing we should consider 100%, in our case 100% will be 100px because we don't have anything to compare the SVG to before adding the SVG into a canvas. Otherwise we could take canvas widht and height. --- src/parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.js b/src/parser.js index 9b6631b9..4a38d166 100644 --- a/src/parser.js +++ b/src/parser.js @@ -510,8 +510,8 @@ parseUseDirectives(doc); var viewBoxAttr = doc.getAttribute('viewBox'), - widthAttr = parseUnit(doc.getAttribute('width')), - heightAttr = parseUnit(doc.getAttribute('height')), + widthAttr = parseUnit(doc.getAttribute('width') || '100%'), + heightAttr = parseUnit(doc.getAttribute('height') || '100%'), viewBoxWidth, viewBoxHeight;