Преглед изворни кода

prevent setting class attribute to null

Gildas пре 7 година
родитељ
комит
1359335d75
1 измењених фајлова са 4 додато и 1 уклоњено
  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");