1
0
Эх сурвалжийг харах

fixed class attribute compression

Gildas 7 жил өмнө
parent
commit
948e6fbd30

+ 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"'`=<>]+$/);