mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 23:02:45 +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
|
// Check remaining elements for blacklisted attributes
|
||||||
if(element.hasAttributes()){
|
if(element.hasAttributes()){
|
||||||
for (const attribute of element.attributes){
|
for (const attribute of element.attributes){
|
||||||
let result = false;
|
for (const test of blacklistAttrs) {
|
||||||
blacklistAttrs.forEach((test)=>{result ||= test(attribute);});
|
if(test(attribute)){
|
||||||
if(result) element.removeAttribute(attribute.localName);
|
element.removeAttribute(attribute.localName);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user