Simplify logic & reduce nesting

This commit is contained in:
G.Ambatte committed 2024-10-29 17:27:59 +13:00
1 parent 9edf65c252
commit 0fda0673b2
1 file changed
+1 -5
+1 -5
View File
@@ -31,16 +31,12 @@ function safeHTML(htmlString) {
return;
}
// Check remaining elements for blacklisted attributes
if(element.hasAttributes()){
for (const attribute of element.attributes){
for (const test of blacklistAttrs) {
if(test(attribute)){
if(blacklistAttrs.some((test)=>{return test(attribute);})) {
element.removeAttribute(attribute.localName);
break;
};
};
};
};
});
return div.innerHTML;