diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-05-09 16:50:47 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-05-12 19:21:36 +0300 |
commit | 86f2c014592dfacdceef70ed05070b2548f74805 (patch) | |
tree | 398254007fcad264075441781bd455e073c3e3f9 /js/src/tools | |
parent | 955c437f32a3d83da5840b5fee29a7c606474c99 (diff) |
Partially revert "Use regex.test() when we want to check for a Boolean. (#29969)"
This partially reverts commit 6c464938039e4fb23af4a35146250da9e1630de4.
Diffstat (limited to 'js/src/tools')
-rw-r--r-- | js/src/tools/sanitizer.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/js/src/tools/sanitizer.js b/js/src/tools/sanitizer.js index 0c3d4813b9..4ff3f7aa68 100644 --- a/js/src/tools/sanitizer.js +++ b/js/src/tools/sanitizer.js @@ -71,7 +71,7 @@ function 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 @@ -81,7 +81,7 @@ function 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 } } |