0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Event-handler: use Array.find instead of for

This commit is contained in:
GeoSot 2021-12-16 13:43:36 +02:00 committed by XhmikosR
parent fc7c5fcb7a
commit a1e924c4da

View File

@ -125,15 +125,8 @@ function bootstrapDelegationHandler(element, selector, fn) {
}
function findHandler(events, handler, delegationSelector = null) {
for (const uidEvent of Object.keys(events)) {
const event = events[uidEvent]
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
return event
}
}
return null
return Object.values(events)
.find(event => event.originalHandler === handler && event.delegationSelector === delegationSelector)
}
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {