Unverified Commit b07b3420 authored by XhmikosR's avatar XhmikosR Committed by GitHub
Browse files

Partially Revert "Use regex.test() when we want to check for a Boolean. (#29969)" (#30770)

This partially reverts commit 9c2b9ac7.
parent 97eb2c1e
Showing with 2 additions and 2 deletions
+2 -2
...@@ -37,7 +37,7 @@ const allowedAttribute = (attr, allowedAttributeList) => { ...@@ -37,7 +37,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
if (allowedAttributeList.indexOf(attrName) !== -1) { if (allowedAttributeList.indexOf(attrName) !== -1) {
if (uriAttrs.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 return true
...@@ -47,7 +47,7 @@ const allowedAttribute = (attr, allowedAttributeList) => { ...@@ -47,7 +47,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
// Check if a regular expression validates the attribute. // Check if a regular expression validates the attribute.
for (let i = 0, len = regExp.length; i < len; i++) { for (let i = 0, len = regExp.length; i < len; i++) {
if (regExp[i].test(attrName)) { if (attrName.match(regExp[i])) {
return true return true
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment