"unicorn/prefer-node-remove": "off",
"unicorn/prefer-optional-catch-binding": "off",
"unicorn/prefer-query-selector": "off",
- "unicorn/prefer-set-has": "off",
"unicorn/prevent-abbreviations": "off"
}
}
}
}
-const utilObjects = [
+const utilObjects = new Set([
'Util',
'Sanitizer'
-]
+])
-const domObjects = [
+const domObjects = new Set([
'Data',
'EventHandler',
'Manipulator',
'SelectorEngine'
-]
+])
const build = async plugin => {
console.log(`Building ${plugin} plugin...`)
const pluginFilename = path.basename(bsPlugins[plugin])
let pluginPath = rootPath
- if (utilObjects.includes(plugin)) {
+ if (utilObjects.has(plugin)) {
pluginPath = `${rootPath}/util/`
}
- if (domObjects.includes(plugin)) {
+ if (domObjects.has(plugin)) {
pluginPath = `${rootPath}/dom/`
}
mouseenter: 'mouseover',
mouseleave: 'mouseout'
}
-const nativeEvents = [
+const nativeEvents = new Set([
'click',
'dblclick',
'mouseup',
'error',
'abort',
'scroll'
-]
+])
/**
* ------------------------------------------------------------------------
typeEvent = custom
}
- const isNative = nativeEvents.includes(typeEvent)
+ const isNative = nativeEvents.has(typeEvent)
if (!isNative) {
typeEvent = originalTypeEvent
const $ = getjQuery()
const typeEvent = event.replace(stripNameRegex, '')
const inNamespace = event !== typeEvent
- const isNative = nativeEvents.includes(typeEvent)
+ const isNative = nativeEvents.has(typeEvent)
let jQueryEvent
let bubbles = true
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-tooltip'
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
-const DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn']
+const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])
const DefaultType = {
animation: 'boolean',
const dataAttributes = Manipulator.getDataAttributes(this.element)
Object.keys(dataAttributes).forEach(dataAttr => {
- if (DISALLOWED_ATTRIBUTES.includes(dataAttr)) {
+ if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
delete dataAttributes[dataAttr]
}
})
* --------------------------------------------------------------------------
*/
-const uriAttrs = [
+const uriAttrs = new Set([
'background',
'cite',
'href',
'poster',
'src',
'xlink:href'
-]
+])
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
const attrName = attr.nodeName.toLowerCase()
if (allowedAttributeList.includes(attrName)) {
- if (uriAttrs.includes(attrName)) {
+ if (uriAttrs.has(attrName)) {
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
}