mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
Replace event.delegateTarget with event.target
No need for fixEvent() anymore
This commit is contained in:
parent
dcd99aa7d1
commit
d7f0f1aac9
@ -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)
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user