From: XhmikosR Date: Tue, 5 Oct 2021 21:23:14 +0000 (+0300) Subject: util/sanitizer.js: use `Array.every()` (#35120) X-Git-Tag: v5.2.0-beta1~473 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2596c97;p=thirdparty%2Fbootstrap.git util/sanitizer.js: use `Array.every()` (#35120) --- diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js index e27961e9a3..f5a8287cd0 100644 --- a/js/src/util/sanitizer.js +++ b/js/src/util/sanitizer.js @@ -43,16 +43,9 @@ const allowedAttribute = (attribute, allowedAttributeList) => { return true } - const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp) - // Check if a regular expression validates the attribute. - for (const element of regExp) { - if (element.test(attributeName)) { - return true - } - } - - return false + return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp) + .every(regex => regex.test(attributeName)) } export const DefaultAllowlist = {