mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 00:42:47 +00:00
Simplify logic & reduce nesting
This commit is contained in:
@@ -31,16 +31,12 @@ function safeHTML(htmlString) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check remaining elements for blacklisted attributes
|
// Check remaining elements for blacklisted attributes
|
||||||
if(element.hasAttributes()){
|
|
||||||
for (const attribute of element.attributes){
|
for (const attribute of element.attributes){
|
||||||
for (const test of blacklistAttrs) {
|
if(blacklistAttrs.some((test)=>{return test(attribute);})) {
|
||||||
if(test(attribute)){
|
|
||||||
element.removeAttribute(attribute.localName);
|
element.removeAttribute(attribute.localName);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
|
|||||||
Reference in New Issue
Block a user