diff --git a/src/Latte/Compiler/Escaper.php b/src/Latte/Compiler/Escaper.php index 0b47cef8d..0e002a6cb 100644 --- a/src/Latte/Compiler/Escaper.php +++ b/src/Latte/Compiler/Escaper.php @@ -120,7 +120,7 @@ public function enterHtmlText(ElementNode $el): void if ($el->is('script')) { $type = $el->getAttribute('type'); if ($type === true || $type === null - || is_string($type) && preg_match('#((application|text)/(((x-)?java|ecma|j|live)script|json)|text/plain|module|importmap|)$#Ai', $type) + || is_string($type) && preg_match('#((application|text)/(((x-)?java|ecma|j|live)script|json)|application/.+\+json|text/plain|module|importmap|)$#Ai', $type) ) { $this->subType = self::JavaScript; diff --git a/tests/common/contentType.html.javascript.phpt b/tests/common/contentType.html.javascript.phpt index 167168ff0..dec73ad21 100644 --- a/tests/common/contentType.html.javascript.phpt +++ b/tests/common/contentType.html.javascript.phpt @@ -88,6 +88,11 @@ Assert::match( $latte->renderToString(''), ); +Assert::match( + '', + $latte->renderToString(''), +); + Assert::match( '', $latte->renderToString(''),