Skip to content
Permalink
Browse files

fix(v-b-tooltip, v-b-popover): ensure reference to trigger element is…

… passed to title/content function (fixes #4331) (#4332)
  • Loading branch information
tmorehouse committed Oct 31, 2019
1 parent 731365b commit ea0cbda18b58a619c1ddd100d3b48905f88bf926
Showing with 5 additions and 5 deletions.
  1. +3 −3 src/directives/popover/popover.js
  2. +2 −2 src/directives/tooltip/tooltip.js
@@ -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)
@@ -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]
}
})
@@ -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)
})
}
})
@@ -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)

0 comments on commit ea0cbda

Please sign in to comment.
You can’t perform that action at this time.