Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/src/util
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2021-10-06 00:23:14 +0300
committerGitHub <noreply@github.com>2021-10-06 00:23:14 +0300
commit2596c9703462f327e20e0464cff26c5ed1f091da (patch)
tree837b4fd6343f612903895bd8d05f42ffdbe37798 /js/src/util
parent598b4c59a6f841fc22908c40c7b078e3a065124d (diff)
util/sanitizer.js: use `Array.every()` (#35120)
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/sanitizer.js11
1 files changed, 2 insertions, 9 deletions
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 = {