Forráskód Böngészése

prevent setting class attribute to null

Gildas 7 éve
szülő
commit
1359335d75
1 módosított fájl, 4 hozzáadás és 1 törlés
  1. 4 1
      lib/single-file/html-images-minifier.js

+ 4 - 1
lib/single-file/html-images-minifier.js

@@ -167,7 +167,10 @@ this.imagesMinifier = this.imagesMinifier || (() => {
 								}
 							}
 						});
-						svgElement.setAttribute("class", imgElement.getAttribute("class"));
+						const className = imgElement.getAttribute("class");
+						if (className) {
+							svgElement.setAttribute("class", className);
+						}
 						const title = imgElement.getAttribute("title");
 						if (title) {
 							const titleElement = doc.createElementNS(SVG_NS, "title");