0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Simplify logic & reduce nesting

This commit is contained in:
G.Ambatte
2024-10-29 17:27:59 +13:00
parent 9edf65c252
commit 0fda0673b2

View File

@@ -31,14 +31,10 @@ 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)){
element.removeAttribute(attribute.localName);
break;
};
};
for (const attribute of element.attributes){
if(blacklistAttrs.some((test)=>{return test(attribute);})) {
element.removeAttribute(attribute.localName);
break;
};
};
});