Skip to content

Commit

Permalink
fix(v-b-tooltip, v-b-popover): ensure reference to trigger element is…
Browse files Browse the repository at this point in the history
… passed to title/content function (fixes #4331) (#4332)
  • Loading branch information
tmorehouse committed Oct 31, 2019
1 parent 731365b commit ea0cbda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/directives/popover/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ const applyPopover = (el, bindings, vnode) => {
// and content if they are functions
const data = {}
if (isFunction(config.title)) {
data.title = config.title()
data.title = config.title(el)
}
if (isFunction(config.content)) {
data.content = config.content()
data.content = config.content(el)
}
if (keys(data).length > 0) {
el[BV_POPOVER].updateData(data)
Expand Down Expand Up @@ -233,7 +233,7 @@ const applyPopover = (el, bindings, vnode) => {
// If title/content is a function, we execute it here
newData[prop] =
(prop === 'title' || prop === 'content') && isFunction(data[prop])
? data[prop]()
? data[prop](el)
: data[prop]
}
})
Expand Down
4 changes: 2 additions & 2 deletions src/directives/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const applyTooltip = (el, bindings, vnode) => {
// Before showing the tooltip, we update the title if it is a function
if (isFunction(config.title)) {
el[BV_TOOLTIP].updateData({
title: config.title()
title: config.title(el)
})
}
})
Expand Down Expand Up @@ -225,7 +225,7 @@ const applyTooltip = (el, bindings, vnode) => {
// We only pass data properties that have changed
if (data[prop] !== oldData[prop]) {
// if title is a function, we execute it here
newData[prop] = prop === 'title' && isFunction(data[prop]) ? data[prop]() : data[prop]
newData[prop] = prop === 'title' && isFunction(data[prop]) ? data[prop](el) : data[prop]
}
})
el[BV_TOOLTIP].updateData(newData)
Expand Down

0 comments on commit ea0cbda

Please sign in to comment.