зеркало из https://github.com/twbs/bootstrap.git
Switch to `String.includes()`
This commit is contained in:
Родитель
470e99ed5f
Коммит
b9f7668cf6
|
@ -51,7 +51,6 @@
|
|||
"unicorn/no-useless-undefined": "off",
|
||||
"unicorn/prefer-array-find": "off",
|
||||
"unicorn/prefer-dataset": "off",
|
||||
"unicorn/prefer-includes": "off",
|
||||
"unicorn/prefer-node-append": "off",
|
||||
"unicorn/prefer-node-remove": "off",
|
||||
"unicorn/prefer-number-properties": "off",
|
||||
|
|
|
@ -151,7 +151,7 @@ function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
|||
typeEvent = custom
|
||||
}
|
||||
|
||||
const isNative = nativeEvents.indexOf(typeEvent) > -1
|
||||
const isNative = nativeEvents.includes(typeEvent)
|
||||
|
||||
if (!isNative) {
|
||||
typeEvent = originalTypeEvent
|
||||
|
@ -210,7 +210,7 @@ function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
|||
const storeElementEvent = events[typeEvent] || {}
|
||||
|
||||
Object.keys(storeElementEvent).forEach(handlerKey => {
|
||||
if (handlerKey.indexOf(namespace) > -1) {
|
||||
if (handlerKey.includes(namespace)) {
|
||||
const event = storeElementEvent[handlerKey]
|
||||
|
||||
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector)
|
||||
|
@ -257,7 +257,7 @@ const EventHandler = {
|
|||
Object.keys(storeElementEvent).forEach(keyHandlers => {
|
||||
const handlerKey = keyHandlers.replace(stripUidRegex, '')
|
||||
|
||||
if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
|
||||
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
||||
const event = storeElementEvent[keyHandlers]
|
||||
|
||||
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector)
|
||||
|
@ -273,7 +273,7 @@ const EventHandler = {
|
|||
const $ = getjQuery()
|
||||
const typeEvent = event.replace(stripNameRegex, '')
|
||||
const inNamespace = event !== typeEvent
|
||||
const isNative = nativeEvents.indexOf(typeEvent) > -1
|
||||
const isNative = nativeEvents.includes(typeEvent)
|
||||
|
||||
let jQueryEvent
|
||||
let bubbles = true
|
||||
|
|
|
@ -679,7 +679,7 @@ class Tooltip {
|
|||
const dataAttributes = Manipulator.getDataAttributes(this.element)
|
||||
|
||||
Object.keys(dataAttributes).forEach(dataAttr => {
|
||||
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
||||
if (DISALLOWED_ATTRIBUTES.includes(dataAttr)) {
|
||||
delete dataAttributes[dataAttr]
|
||||
}
|
||||
})
|
||||
|
|
|
@ -35,8 +35,8 @@ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|vid
|
|||
const allowedAttribute = (attr, allowedAttributeList) => {
|
||||
const attrName = attr.nodeName.toLowerCase()
|
||||
|
||||
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
||||
if (uriAttrs.indexOf(attrName) !== -1) {
|
||||
if (allowedAttributeList.includes(attrName)) {
|
||||
if (uriAttrs.includes(attrName)) {
|
||||
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
|||
const el = elements[i]
|
||||
const elName = el.nodeName.toLowerCase()
|
||||
|
||||
if (allowlistKeys.indexOf(elName) === -1) {
|
||||
if (!allowlistKeys.includes(elName)) {
|
||||
el.parentNode.removeChild(el)
|
||||
|
||||
continue
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
"unicorn/no-for-loop": "off",
|
||||
"unicorn/no-null": "off",
|
||||
"unicorn/prefer-dataset": "off",
|
||||
"unicorn/prefer-includes": "off",
|
||||
"unicorn/prefer-node-append": "off",
|
||||
"unicorn/prefer-query-selector": "off",
|
||||
"unicorn/prevent-abbreviations": "off"
|
||||
|
|
Загрузка…
Ссылка в новой задаче