aboutsummaryrefslogtreecommitdiff
path: root/js/src/dom
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-12-16 13:43:36 +0200
committerXhmikosR <[email protected]>2022-02-01 12:43:19 +0200
commita1e924c4da03fd05a1c50d7b278350c3cfcfe5c4 (patch)
treeaade41167a837e1916ab4b67eac8b9c2f9435584 /js/src/dom
parentfc7c5fcb7a5c6b9a27fd10398f6a4c52bf1c2a38 (diff)
downloadbootstrap-a1e924c4da03fd05a1c50d7b278350c3cfcfe5c4.tar.xz
bootstrap-a1e924c4da03fd05a1c50d7b278350c3cfcfe5c4.zip
Event-handler: use `Array.find` instead of `for`
Diffstat (limited to 'js/src/dom')
-rw-r--r--js/src/dom/event-handler.js11
1 files changed, 2 insertions, 9 deletions
diff --git a/js/src/dom/event-handler.js b/js/src/dom/event-handler.js
index 49b75d4ad..70d2f1708 100644
--- a/js/src/dom/event-handler.js
+++ b/js/src/dom/event-handler.js
@@ -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) {