mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-23 00:39:54 +00:00
Use Object.entries
in more places (#37482)
This commit is contained in:
parent
0446e22b5a
commit
2fde88c200
@ -198,9 +198,8 @@ function removeHandler(element, events, typeEvent, handler, delegationSelector)
|
|||||||
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
||||||
const storeElementEvent = events[typeEvent] || {}
|
const storeElementEvent = events[typeEvent] || {}
|
||||||
|
|
||||||
for (const handlerKey of Object.keys(storeElementEvent)) {
|
for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
|
||||||
if (handlerKey.includes(namespace)) {
|
if (handlerKey.includes(namespace)) {
|
||||||
const event = storeElementEvent[handlerKey]
|
|
||||||
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)
|
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,11 +247,10 @@ const EventHandler = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const keyHandlers of Object.keys(storeElementEvent)) {
|
for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
|
||||||
const handlerKey = keyHandlers.replace(stripUidRegex, '')
|
const handlerKey = keyHandlers.replace(stripUidRegex, '')
|
||||||
|
|
||||||
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
||||||
const event = storeElementEvent[keyHandlers]
|
|
||||||
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)
|
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -577,9 +577,9 @@ class Tooltip extends BaseComponent {
|
|||||||
_getDelegateConfig() {
|
_getDelegateConfig() {
|
||||||
const config = {}
|
const config = {}
|
||||||
|
|
||||||
for (const key in this._config) {
|
for (const [key, value] of Object.entries(this._config)) {
|
||||||
if (this.constructor.Default[key] !== this._config[key]) {
|
if (this.constructor.Default[key] !== value) {
|
||||||
config[key] = this._config[key]
|
config[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,7 @@ class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
|
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
|
||||||
for (const property of Object.keys(configTypes)) {
|
for (const [property, expectedTypes] of Object.entries(configTypes)) {
|
||||||
const expectedTypes = configTypes[property]
|
|
||||||
const value = config[property]
|
const value = config[property]
|
||||||
const valueType = isElement(value) ? 'element' : toType(value)
|
const valueType = isElement(value) ? 'element' : toType(value)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user