From 0fda0673b2f8e96ae88542ef05964e605db1c7d2 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 29 Oct 2024 17:27:59 +1300 Subject: [PATCH] Simplify logic & reduce nesting --- client/homebrew/brewRenderer/safeHTML.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/client/homebrew/brewRenderer/safeHTML.js b/client/homebrew/brewRenderer/safeHTML.js index 43828bc1c..378cff9fb 100644 --- a/client/homebrew/brewRenderer/safeHTML.js +++ b/client/homebrew/brewRenderer/safeHTML.js @@ -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; }; }; });