Make sure initial comments are preserved in HTML editor (#1647)

This commit is contained in:
Henrik Giesel 2022-02-08 05:07:09 +01:00 committed by GitHub
parent f7391e0366
commit 8c21b74ece

View file

@ -55,11 +55,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
}
}
function parseAsHTML(html: string): string {
const doc = parser.parseFromString(
parsingInstructions.join("") + html,
"text/html",
function createDummyDoc(html: string): string {
return (
"<html><head></head><body>" +
parsingInstructions.join("") +
html +
"</body>"
);
}
function parseAsHTML(html: string): string {
const doc = parser.parseFromString(createDummyDoc(html), "text/html");
const body = doc.body;
removeTag(body, "script");