diff options
author | XhmikosR <xhmikosr@gmail.com> | 2019-06-03 14:08:17 +0300 |
---|---|---|
committer | Johann-S <johann.servoire@gmail.com> | 2019-06-03 14:08:17 +0300 |
commit | 8a79cf894d3fe53b5d059a732aab7c9df02a405f (patch) | |
tree | 10d8e0709bc49fffbc629971890d2a666b3a71b8 /js | |
parent | 319de5b309561146d1d5803b553379591d890411 (diff) |
event-handler.js: use a plain for loop. (#28853)
Diffstat (limited to 'js')
-rw-r--r-- | js/src/dom/event-handler.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/js/src/dom/event-handler.js b/js/src/dom/event-handler.js index 9e590de88c..2dff885354 100644 --- a/js/src/dom/event-handler.js +++ b/js/src/dom/event-handler.js @@ -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 } |