From 9aac11527bdc0644b7106c90af3bac29945f238d Mon Sep 17 00:00:00 2001 From: Tyler Bruffy Date: Wed, 30 Nov 2016 17:14:58 -0500 Subject: [PATCH] Fix for auto width/height elements --- svg-crowbar-2.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/svg-crowbar-2.js b/svg-crowbar-2.js index 12d58ed..06bf90c 100644 --- a/svg-crowbar-2.js +++ b/svg-crowbar-2.js @@ -211,9 +211,13 @@ function setInlineStyles(svg, emptySvgDeclarationComputed) { function explicitlySetStyle (element) { + var clientRect = { width: "auto", height: "auto"}; var cSSStyleDeclarationComputed = getComputedStyle(element); var i, len, key, value; var computedStyleStr = ""; + if (element.tagName === "rect") { + clientRect = element.getBoundingClientRect(); + } for (i=0, len=cSSStyleDeclarationComputed.length; i