소스 검색

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");