From 19c30fa4604d9c5673f0e1b2ec11dcfcd26d1d0d Mon Sep 17 00:00:00 2001
From: Ionel-Alex Caizer <ionel.caizer@in2code.de>
Date: Sat, 6 Aug 2022 00:29:52 +0200
Subject: [PATCH] [TASK] Remove default script type "text/javascript" from
 <script> tags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Omit obsolete type=text/javascript in PageRenderer
See: https://html.spec.whatwg.org/multipage/scripting.html#the-script-element

Resolves: #97990
Releases: main
Change-Id: I4af66f10fd8186817fd66432d96b50de4cad0a5f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75383
Tested-by: Nikita Hovratov <nikita.h@live.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Nikita Hovratov <nikita.h@live.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/core/Classes/Page/PageRenderer.php | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php
index a1e4136993f4..09d1bca5c4d7 100644
--- a/typo3/sysext/core/Classes/Page/PageRenderer.php
+++ b/typo3/sysext/core/Classes/Page/PageRenderer.php
@@ -304,7 +304,7 @@ class PageRenderer implements SingletonInterface
      * @var array{0: string, 1: string}
      */
     protected $inlineJavascriptWrap = [
-        '<script type="text/javascript">' . LF . '/*<![CDATA[*/' . LF,
+        '<script>' . LF . '/*<![CDATA[*/' . LF,
         '/*]]>*/' . LF . '</script>' . LF,
     ];
 
@@ -1075,7 +1075,7 @@ class PageRenderer implements SingletonInterface
      * @param string $crossorigin CORS settings attribute
      * @param bool $nomodule Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
      */
-    public function addJsLibrary($name, $file, $type = 'text/javascript', $compress = false, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
+    public function addJsLibrary($name, $file, $type = '', $compress = false, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
     {
         if (!isset($this->jsLibs[strtolower($name)])) {
             $this->jsLibs[strtolower($name)] = [
@@ -1113,7 +1113,7 @@ class PageRenderer implements SingletonInterface
      * @param string $crossorigin CORS settings attribute
      * @param bool $nomodule Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
      */
-    public function addJsFooterLibrary($name, $file, $type = 'text/javascript', $compress = false, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
+    public function addJsFooterLibrary($name, $file, $type = '', $compress = false, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
     {
         $name .= '_jsFooterLibrary';
         if (!isset($this->jsLibs[strtolower($name)])) {
@@ -1151,7 +1151,7 @@ class PageRenderer implements SingletonInterface
      * @param string $crossorigin CORS settings attribute
      * @param bool $nomodule Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
      */
-    public function addJsFile($file, $type = 'text/javascript', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
+    public function addJsFile($file, $type = '', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
     {
         if (!isset($this->jsFiles[$file])) {
             $this->jsFiles[$file] = [
@@ -1188,7 +1188,7 @@ class PageRenderer implements SingletonInterface
      * @param string $crossorigin CORS settings attribute
      * @param bool $nomodule Flag if property 'nomodule="nomodule"' should be added to JavaScript tags
      */
-    public function addJsFooterFile($file, $type = 'text/javascript', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
+    public function addJsFooterFile($file, $type = '', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $async = false, $integrity = '', $defer = false, $crossorigin = '', $nomodule = false)
     {
         if (!isset($this->jsFiles[$file])) {
             $this->jsFiles[$file] = [
-- 
GitLab