diff options
author | Tanguy Krotoff <tkrotoff@gmail.com> | 2020-04-15 17:59:53 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-04-17 18:22:15 +0300 |
commit | d7f0f1aac92e70ca2324c64163d021c8f12ef948 (patch) | |
tree | 4b7a8433c170b4efb8f2d31c92c2c259706e6f02 | |
parent | dcd99aa7d1cb8018a1378bc75053853e07edbfff (diff) |
Replace event.delegateTarget with event.target
No need for fixEvent() anymore
-rw-r--r-- | js/src/dom/event-handler.js | 7 | ||||
-rw-r--r-- | js/src/tooltip.js | 18 |
2 files changed, 9 insertions, 16 deletions
diff --git a/js/src/dom/event-handler.js b/js/src/dom/event-handler.js index e43edd6ee2..f71b528ea8 100644 --- a/js/src/dom/event-handler.js +++ b/js/src/dom/event-handler.js @@ -92,13 +92,8 @@ function getEvent(element) { return eventRegistry[uid] } -function fixEvent(event, element) { - event.delegateTarget = element -} - function bootstrapHandler(element, fn) { return function handler(event) { - fixEvent(event, element) if (handler.oneOff) { EventHandler.off(element, event.type, fn) } @@ -114,8 +109,6 @@ function bootstrapDelegationHandler(element, selector, fn) { for (let { target } = event; target && target !== this; target = target.parentNode) { for (let i = domElements.length; i--;) { if (domElements[i] === target) { - fixEvent(event, target) - if (handler.oneOff) { EventHandler.off(element, event.type, fn) } diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 3f40b3da12..6b31acf49c 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -194,14 +194,14 @@ class Tooltip { if (event) { const dataKey = this.constructor.DATA_KEY - let context = Data.getData(event.delegateTarget, dataKey) + let context = Data.getData(event.target, dataKey) if (!context) { context = new this.constructor( - event.delegateTarget, + event.target, this._getDelegateConfig() ) - Data.setData(event.delegateTarget, dataKey, context) + Data.setData(event.target, dataKey, context) } context._activeTrigger.click = !context._activeTrigger.click @@ -587,14 +587,14 @@ class Tooltip { _enter(event, context) { const dataKey = this.constructor.DATA_KEY - context = context || Data.getData(event.delegateTarget, dataKey) + context = context || Data.getData(event.target, dataKey) if (!context) { context = new this.constructor( - event.delegateTarget, + event.target, this._getDelegateConfig() ) - Data.setData(event.delegateTarget, dataKey, context) + Data.setData(event.target, dataKey, context) } if (event) { @@ -627,14 +627,14 @@ class Tooltip { _leave(event, context) { const dataKey = this.constructor.DATA_KEY - context = context || Data.getData(event.delegateTarget, dataKey) + context = context || Data.getData(event.target, dataKey) if (!context) { context = new this.constructor( - event.delegateTarget, + event.target, this._getDelegateConfig() ) - Data.setData(event.delegateTarget, dataKey, context) + Data.setData(event.target, dataKey, context) } if (event) { |