diff --git a/lib/Widget/Render/WidgetHtmlRenderer.php b/lib/Widget/Render/WidgetHtmlRenderer.php
index fee65209ab..5492a3ee60 100644
--- a/lib/Widget/Render/WidgetHtmlRenderer.php
+++ b/lib/Widget/Render/WidgetHtmlRenderer.php
@@ -328,7 +328,7 @@ public function decorateForPreview(
// Handle CSP in preview
$html = new \DOMDocument();
- $html->loadHTML($output, LIBXML_NOERROR | LIBXML_NOWARNING);
+ $html->loadHTML($output, LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_SCHEMA_CREATE);
foreach ($html->getElementsByTagName('script') as $node) {
// We add this requests cspNonce to every script tag
if ($node instanceof \DOMElement) {