From 4eaf28d5ccac8e1083e632c7f736f4910af01d4d Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 21 Nov 2024 20:51:06 +0800 Subject: [PATCH] createElementFromHTML --- web_src/js/utils/dom.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/utils/dom.ts b/web_src/js/utils/dom.ts index 8bb9b8defc..4bbb0c414a 100644 --- a/web_src/js/utils/dom.ts +++ b/web_src/js/utils/dom.ts @@ -301,13 +301,13 @@ export function replaceTextareaSelection(textarea: HTMLTextAreaElement, text: st } // Warning: Do not enter any unsanitized variables here -export function createElementFromHTML(htmlString: string): T { +export function createElementFromHTML(htmlString: string): T { htmlString = htmlString.trim(); // some tags like "tr" are special, it must use a correct parent container to create if (htmlString.startsWith('('tr'); } const div = document.createElement('div'); div.innerHTML = htmlString;