]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Use regex.test() when we want to check for a Boolean. (#29969)
authorXhmikosR <xhmikosr@gmail.com>
Tue, 7 Jan 2020 20:07:51 +0000 (22:07 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Jan 2020 20:07:51 +0000 (22:07 +0200)
build/vnu-jar.js
js/src/popover.js
js/src/tooltip.js
js/src/util/sanitizer.js

index 53fc58636f8da0012ee38eac8477e9fb1f3ac83b..4018873f8dcddc53b5ed1a191e5e4c447f1de8bb 100644 (file)
@@ -18,7 +18,7 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
     return
   }
 
-  const is32bitJava = !stderr.match(/64-Bit/)
+  const is32bitJava = !/64-Bit/.test(stderr)
 
   // vnu-jar accepts multiple ignores joined with a `|`.
   // Also note that the ignores are regular expressions.
index a633af4ba0b9325eea0ccd215d90ab7864ae2928..d71a78236cd49df29438f188a5b039952dcc79df 100644 (file)
@@ -135,7 +135,6 @@ class Popover extends Tooltip {
   _cleanTipClass() {
     const tip = this.getTipElement()
     const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
-
     if (tabClass !== null && tabClass.length > 0) {
       tabClass.map(token => token.trim())
         .forEach(tClass => tip.classList.remove(tClass))
index b4f047b70ef2174ca1afe0587d8d8253f86f1e82..1bc000d2ccc701493b3c5f1582db7a1cc6e5b0a3 100644 (file)
@@ -747,9 +747,8 @@ class Tooltip {
   _cleanTipClass() {
     const tip = this.getTipElement()
     const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
-    if (tabClass !== null && tabClass.length) {
-      tabClass
-        .map(token => token.trim())
+    if (tabClass !== null && tabClass.length > 0) {
+      tabClass.map(token => token.trim())
         .forEach(tClass => tip.classList.remove(tClass))
     }
   }
index a85bc5f91d0edc244956b888342bbbfdfed32bae..8f72d2005af03c7651d7f59de4974bc0b092f45a 100644 (file)
@@ -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
     }
   }