fix xss issue
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export default function elementFromString(value: string): HTMLDivElement {
|
||||
const element = document.createElement('div')
|
||||
element.innerHTML = value.trim()
|
||||
export default function elementFromString(value: string): HTMLElement {
|
||||
const htmlString = `<div>${value}</div>`
|
||||
const parser = new window.DOMParser
|
||||
const element = parser.parseFromString(htmlString, 'text/html').body
|
||||
|
||||
return element
|
||||
}
|
||||
Reference in New Issue
Block a user