From 43059410c59ed1cea3edadad0b2b8be477de8a65 Mon Sep 17 00:00:00 2001 From: Ajay Dhangar <99037494+ajay-dhangar@users.noreply.github.com> Date: Sat, 31 Jan 2026 21:27:10 +0530 Subject: [PATCH] Potential fix for code scanning alert no. 1821: DOM text reinterpreted as HTML Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/pages/LiveEditor/BasicEditor.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/pages/LiveEditor/BasicEditor.tsx b/src/pages/LiveEditor/BasicEditor.tsx index 119e87c3d..2ca0adba4 100644 --- a/src/pages/LiveEditor/BasicEditor.tsx +++ b/src/pages/LiveEditor/BasicEditor.tsx @@ -26,12 +26,6 @@ const BasicEditor = () => { } const iframe = iframeRef.current; - const document = iframe.contentDocument; - - if (!document) { - alert("iframe contentDocument is not available"); - return; - } const documentContents = ` @@ -46,9 +40,7 @@ const BasicEditor = () => { `; - document.open(); - document.write(documentContents); - document.close(); + iframe.srcdoc = documentContents; }, [html, css, js]); return ( @@ -210,7 +202,12 @@ const BasicEditor = () => { -