replaced confusing loadView behaviour

This commit is contained in:
2026-05-22 13:47:13 +02:00
parent cc81a9764f
commit 3342d10737
5 changed files with 12 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ class Script extends StaticView {
private string $src;
private ?string $nonce;
function __construct($type, $src, $content = "") {
function __construct(string $type, string $src, string $content = "") {
$this->src = $src;
$this->type = $type;
$this->content = $content;
@@ -35,8 +35,8 @@ class Script extends StaticView {
$attributes["nonce"] = $this->nonce;
}
// TODO: do we need to escape the content here?
return html_tag("script", $attributes, $this->content, false);
$escapedContent = str_replace("</script>", "<\\/script>", $this->content);
return html_tag("script", $attributes, $escapedContent, false);
}
public function setNonce(string $nonce) {