mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-30 22:52:24 +01:00
Use regex.test() when we want to check for a Boolean. (#29969)
This commit is contained in:
parent
a7945d4501
commit
9c2b9ac74d
@ -18,7 +18,7 @@ childProcess.exec('java -version', (error, stdout, stderr) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const is32bitJava = !stderr.match(/64-Bit/)
|
const is32bitJava = !/64-Bit/.test(stderr)
|
||||||
|
|
||||||
// vnu-jar accepts multiple ignores joined with a `|`.
|
// vnu-jar accepts multiple ignores joined with a `|`.
|
||||||
// Also note that the ignores are regular expressions.
|
// Also note that the ignores are regular expressions.
|
||||||
|
@ -135,7 +135,6 @@ class Popover extends Tooltip {
|
|||||||
_cleanTipClass() {
|
_cleanTipClass() {
|
||||||
const tip = this.getTipElement()
|
const tip = this.getTipElement()
|
||||||
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
|
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
|
||||||
|
|
||||||
if (tabClass !== null && tabClass.length > 0) {
|
if (tabClass !== null && tabClass.length > 0) {
|
||||||
tabClass.map(token => token.trim())
|
tabClass.map(token => token.trim())
|
||||||
.forEach(tClass => tip.classList.remove(tClass))
|
.forEach(tClass => tip.classList.remove(tClass))
|
||||||
|
@ -747,9 +747,8 @@ class Tooltip {
|
|||||||
_cleanTipClass() {
|
_cleanTipClass() {
|
||||||
const tip = this.getTipElement()
|
const tip = this.getTipElement()
|
||||||
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
|
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
|
||||||
if (tabClass !== null && tabClass.length) {
|
if (tabClass !== null && tabClass.length > 0) {
|
||||||
tabClass
|
tabClass.map(token => token.trim())
|
||||||
.map(token => token.trim())
|
|
||||||
.forEach(tClass => tip.classList.remove(tClass))
|
.forEach(tClass => tip.classList.remove(tClass))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,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 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
|
return true
|
||||||
@ -48,8 +48,8 @@ const allowedAttribute = (attr, allowedAttributeList) => {
|
|||||||
const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp)
|
const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp)
|
||||||
|
|
||||||
// Check if a regular expression validates the attribute.
|
// Check if a regular expression validates the attribute.
|
||||||
for (let i = 0, l = regExp.length; i < l; i++) {
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
||||||
if (attrName.match(regExp[i])) {
|
if (regExp[i].test(attrName)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user