[feat] sanitize performace

This commit is contained in:
kwaroran
2023-06-06 07:19:18 +09:00
parent 0ff767e454
commit 35707ecc46

View File

@@ -26,10 +26,9 @@ DOMPurify.addHook("uponSanitizeElement", (node: HTMLElement, data) => {
}
});
DOMPurify.addHook("uponSanitizeAttribute", (node) => {
const style = node.getAttribute("style");
if(style){
node.setAttribute('style', style.replace(/(absolute)|(z-index)|(fixed)/g, ''))
DOMPurify.addHook("uponSanitizeAttribute", (node, data) => {
if(data.attrName === 'src'){
data.attrValue = data.attrValue.replace(/(absolute)|(z-index)|(fixed)/g, '')
}
})