From b638cca547baac02404d9141ca508f98ae1a18d6 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 4 Jul 2024 09:32:29 +1200 Subject: [PATCH] Stop evaluation tests as soon as one returns true --- client/homebrew/brewRenderer/safeHTML.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/homebrew/brewRenderer/safeHTML.js b/client/homebrew/brewRenderer/safeHTML.js index a13211907..3f0ec1bec 100644 --- a/client/homebrew/brewRenderer/safeHTML.js +++ b/client/homebrew/brewRenderer/safeHTML.js @@ -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; + }; + }; }; }; });