Improve html escape (#34911)

drop "escape-goat"
This commit is contained in:
wxiaoguang authored and GitHub committed 2025-07-01 21:44:05 +08:00
1 parent 35f0b5a3ec
commit 1d4ad5aa2b
25 files changed
+103 -68

No files matched your search

+1
View File
@@ -314,6 +314,7 @@ export function replaceTextareaSelection(textarea: HTMLTextAreaElement, text: st
export function createElementFromHTML<T extends HTMLElement>(htmlString: string): T {
htmlString = htmlString.trim();
// some tags like "tr" are special, it must use a correct parent container to create
// eslint-disable-next-line github/unescaped-html-literal -- FIXME: maybe we need to use other approaches to create elements from HTML, e.g. using DOMParser
if (htmlString.startsWith('<tr')) {
const container = document.createElement('table');
container.innerHTML = htmlString;