aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2020-05-13 22:49:41 +0300
committerGitHub <[email protected]>2020-05-13 22:49:41 +0300
commitb07b34208675055e90a74de55e468101e265f89e (patch)
tree4d57a077740a2ac4e1e5855e1caea233ef8eeca4
parent97eb2c1e247569384d99c89e7560779b9f6419c9 (diff)
downloadbootstrap-b07b34208675055e90a74de55e468101e265f89e.tar.xz
bootstrap-b07b34208675055e90a74de55e468101e265f89e.zip
Partially Revert "Use regex.test() when we want to check for a Boolean. (#29969)" (#30770)
This partially reverts commit 9c2b9ac74d4abb5ec8b7864054315de3409d5f3a.
-rw-r--r--js/src/util/sanitizer.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js
index ffb19e838..35f6db9ec 100644
--- a/js/src/util/sanitizer.js
+++ b/js/src/util/sanitizer.js
@@ -37,7 +37,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
if (allowedAttributeList.indexOf(attrName) !== -1) {
if (uriAttrs.indexOf(attrName) !== -1) {
- return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)
+ return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
}
return true
@@ -47,7 +47,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
// Check if a regular expression validates the attribute.
for (let i = 0, len = regExp.length; i < len; i++) {
- if (regExp[i].test(attrName)) {
+ if (attrName.match(regExp[i])) {
return true
}
}