diff options
| author | XhmikosR <[email protected]> | 2020-01-07 22:07:51 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-01-07 22:07:51 +0200 |
| commit | 9c2b9ac74d4abb5ec8b7864054315de3409d5f3a (patch) | |
| tree | bdd48def07c5ef9c88c01c15554e3acada526b59 /js/src/util | |
| parent | a7945d4501377cd42afd49c0e885b0e1923b36cc (diff) | |
| download | bootstrap-9c2b9ac74d4abb5ec8b7864054315de3409d5f3a.tar.xz bootstrap-9c2b9ac74d4abb5ec8b7864054315de3409d5f3a.zip | |
Use regex.test() when we want to check for a Boolean. (#29969)
Diffstat (limited to 'js/src/util')
| -rw-r--r-- | js/src/util/sanitizer.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js index a85bc5f91..8f72d2005 100644 --- a/js/src/util/sanitizer.js +++ b/js/src/util/sanitizer.js @@ -39,7 +39,7 @@ const allowedAttribute = (attr, allowedAttributeList) => { if (allowedAttributeList.indexOf(attrName) !== -1) { if (uriAttrs.indexOf(attrName) !== -1) { - return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) + return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue) } return true @@ -48,8 +48,8 @@ const allowedAttribute = (attr, allowedAttributeList) => { const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp) // Check if a regular expression validates the attribute. - for (let i = 0, l = regExp.length; i < l; i++) { - if (attrName.match(regExp[i])) { + for (let i = 0, len = regExp.length; i < len; i++) { + if (regExp[i].test(attrName)) { return true } } |
