mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
event-handler.js: use a plain for loop. (#28853)
This commit is contained in:
parent
319de5b309
commit
8a79cf894d
@ -136,11 +136,13 @@ function bootstrapDelegationHandler(element, selector, fn) {
|
||||
}
|
||||
|
||||
function findHandler(events, handler, delegationSelector = null) {
|
||||
for (const uid of Object.keys(events)) {
|
||||
const event = events[uid]
|
||||
const uidEventList = Object.keys(events)
|
||||
|
||||
for (let i = 0, len = uidEventList.length; i < len; i++) {
|
||||
const event = events[uidEventList[i]]
|
||||
|
||||
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
|
||||
return events[uid]
|
||||
return event
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,7 +206,7 @@ function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
|
||||
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
||||
const fn = findHandler(events[typeEvent], handler, delegationSelector)
|
||||
|
||||
if (fn === null) {
|
||||
if (!fn) {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user