소스 검색

fixed class attribute compression

Gildas 7 년 전
부모
커밋
948e6fbd30
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      lib/single-file/serializer.js

+ 1 - 1
lib/single-file/serializer.js

@@ -87,7 +87,7 @@ this.serializer = this.serializer || (() => {
 		Array.from(element.attributes).forEach(attribute => {
 			let value = attribute.value;
 			if (attribute.name == "class") {
-				value = element.classList.toString().trim();
+				value = Array.from(element.classList).map(className => className.trim()).join(" ");
 			}
 			value = value.replace(/&/g, "&").replace(/\u00a0/g, " ").replace(/"/g, """);
 			const validUnquotedValue = value.match(/^[^ \t\n\f\r"'`=<>]+$/);