Add newlines around IIFE-wrapped script content

Without the newlines, a webhook script ending in a line comment
(// ...) would swallow the closing })(); and produce a SyntaxError.
This commit is contained in:
Dannon Baker
2026-04-01 11:30:34 -04:00
parent a64ea631b8
commit 4ff5a57de3
+1 -1
View File
@@ -275,7 +275,7 @@ export function appendScriptStyle(data: Readonly<{ script?: string; styles?: str
if (data.script && data.script !== "") {
const tag = document.createElement("script");
tag.type = "text/javascript";
tag.textContent = `(function(){${data.script}})();`;
tag.textContent = `(function(){\n${data.script}\n})();`;
document.head.appendChild(tag);
}
// create a style tag inside head tag