From c963e64cb994e12105582ce9acab3e5a830bfe55 Mon Sep 17 00:00:00 2001
From: Benjamin Kott <benjamin.kott@outlook.com>
Date: Mon, 28 Aug 2023 12:18:26 +0200
Subject: [PATCH] [TASK] Use <template> for document fragments in form editor

The `script` tag is defined to hold executable code or data and
not template html markup. We are switching this to the `template`
tag that is indended for this usecase.

Resolves: #101769
Releases: main, 12.4
Change-Id: I0657e5cbce7e13770ce88918cb9e4137bf017590
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80681
Tested-by: Benjamin Franzke <ben@bnf.dev>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: core-ci <typo3@b13.com>
---
 typo3/sysext/form/Classes/Controller/FormEditorController.php | 2 +-
 .../Private/Backend/Templates/FormEditor/InlineTemplates.html | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/form/Classes/Controller/FormEditorController.php b/typo3/sysext/form/Classes/Controller/FormEditorController.php
index f3437876e6cc..91a4b5e16d87 100644
--- a/typo3/sysext/form/Classes/Controller/FormEditorController.php
+++ b/typo3/sysext/form/Classes/Controller/FormEditorController.php
@@ -464,7 +464,7 @@ class FormEditorController extends AbstractBackendController
     }
 
     /**
-     * Render the "text/x-formeditor-template" templates.
+     * Render the form editor templates.
      */
     protected function renderFormEditorTemplates(array $formEditorDefinitions): string
     {
diff --git a/typo3/sysext/form/Resources/Private/Backend/Templates/FormEditor/InlineTemplates.html b/typo3/sysext/form/Resources/Private/Backend/Templates/FormEditor/InlineTemplates.html
index f64c9f016db0..59c7c8fe96bd 100644
--- a/typo3/sysext/form/Resources/Private/Backend/Templates/FormEditor/InlineTemplates.html
+++ b/typo3/sysext/form/Resources/Private/Backend/Templates/FormEditor/InlineTemplates.html
@@ -1,7 +1,7 @@
 <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
 <f:for each="{formEditorPartials}" key="formEditorTemplateName" as="formEditorPartial">
-    <script type="text/x-formeditor-template" data-template-name="{formEditorTemplateName}">
+    <template data-template-name="{formEditorTemplateName}">
         <f:render partial="{formEditorPartial}" arguments="{insertRenderablesPanelConfiguration: insertRenderablesPanelConfiguration}" />
-    </script>
+    </template>
 </f:for>
 </html>
-- 
GitLab