|
|
@@ -127,7 +127,21 @@ this.imagesMinifier = this.imagesMinifier || (() => {
|
|
|
const svgElement = doc.createElementNS(SVG_NS, "svg");
|
|
|
const useElement = doc.createElementNS(SVG_NS, "use");
|
|
|
svgElement.appendChild(useElement);
|
|
|
- imgElement.getAttributeNames().forEach(attributeName => attributeName != "src" && svgElement.setAttribute(attributeName, imgElement.getAttribute(attributeName)));
|
|
|
+ imgElement.getAttributeNames().forEach(attributeName => {
|
|
|
+ try {
|
|
|
+ if (attributeName != "src") {
|
|
|
+ svgElement.setAttribute(attributeName, imgElement.getAttribute(attributeName));
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ if (attributeName != "src") {
|
|
|
+ try {
|
|
|
+ svgElement.setAttributeNS(SVG_NS, attributeName, imgElement.getAttribute(attributeName));
|
|
|
+ } catch (error) {
|
|
|
+ /* ignored */
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
svgElement.setAttribute(TRANSFORMED_IMAGE_ATTRIBUTE, "");
|
|
|
svgElement.setAttributeNS(SVG_NS, "viewBox", "0 0 " + width + " " + height);
|
|
|
svgElement.setAttributeNS(SVG_NS, "width", imageData.clientWidth);
|