Răsfoiți Sursa

fixed serialization of template tags

Former-commit-id: 181463a5fcbab714e11f4c1f8cf70a1f0b195f55
Gildas 6 ani în urmă
părinte
comite
d6051bd639
1 a modificat fișierele cu 5 adăugiri și 1 ștergeri
  1. 5 1
      lib/single-file/modules/html-serializer.js

+ 5 - 1
lib/single-file/modules/html-serializer.js

@@ -116,7 +116,11 @@ this.singlefile.lib.modules.serializer = this.singlefile.lib.modules.serializer
 			Array.from(element.attributes).forEach(attribute => content += serializeAttribute(attribute, element, compressHTML));
 			content += ">";
 		}
-		Array.from(element.childNodes).forEach(childNode => content += serialize(childNode, compressHTML));
+		if (element.tagName == "TEMPLATE") {
+			content += element.innerHTML;
+		} else {
+			Array.from(element.childNodes).forEach(childNode => content += serialize(childNode, compressHTML));
+		}
 		const omittedEndTag = compressHTML && OMITTED_END_TAGS.find(omittedEndTag => tagName == omittedEndTag.tagName && omittedEndTag.accept(element.nextSibling, element));
 		if (!omittedEndTag && !SELF_CLOSED_TAG_NAMES.includes(tagName)) {
 			content += "</" + tagName + ">";