mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-23 18:47:11 +00:00
Stop evaluation tests as soon as one returns true
This commit is contained in:
1 parent
2fc5bcabb8
commit
b638cca547
1 file changed
+6
-3
@@ -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