]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Partially revert "Use regex.test() when we want to check for a Boolean. (#29969)"
authorXhmikosR <xhmikosr@gmail.com>
Sat, 9 May 2020 13:50:47 +0000 (16:50 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Tue, 12 May 2020 16:21:36 +0000 (19:21 +0300)
This partially reverts commit 6c464938039e4fb23af4a35146250da9e1630de4.

js/src/tools/sanitizer.js

index 0c3d4813b981399ad163dd7841a0215f5b27aab3..4ff3f7aa6882b15574d7b745ecb3247759460880 100644 (file)
@@ -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
     }
   }