mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
Stop evaluation tests as soon as one returns true
This commit is contained in:
@@ -31,9 +31,12 @@ function safeHTML(htmlString) {
|
||||
// Check remaining elements for blacklisted attributes
|
||||
if(element.hasAttributes()){
|
||||
for (const attribute of element.attributes){
|
||||
let result = false;
|
||||
blacklistAttrs.forEach((test)=>{result ||= test(attribute);});
|
||||
if(result) element.removeAttribute(attribute.localName);
|
||||
for (const test of blacklistAttrs) {
|
||||
if(test(attribute)){
|
||||
element.removeAttribute(attribute.localName);
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user