Skip to content

Commit ea0cbda

Browse files
authored
fix(v-b-tooltip, v-b-popover): ensure reference to trigger element is passed to title/content function (fixes #4331) (#4332)
1 parent 731365b commit ea0cbda

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/directives/popover/popover.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ const applyPopover = (el, bindings, vnode) => {
193193
// and content if they are functions
194194
const data = {}
195195
if (isFunction(config.title)) {
196-
data.title = config.title()
196+
data.title = config.title(el)
197197
}
198198
if (isFunction(config.content)) {
199-
data.content = config.content()
199+
data.content = config.content(el)
200200
}
201201
if (keys(data).length > 0) {
202202
el[BV_POPOVER].updateData(data)
@@ -233,7 +233,7 @@ const applyPopover = (el, bindings, vnode) => {
233233
// If title/content is a function, we execute it here
234234
newData[prop] =
235235
(prop === 'title' || prop === 'content') && isFunction(data[prop])
236-
? data[prop]()
236+
? data[prop](el)
237237
: data[prop]
238238
}
239239
})

src/directives/tooltip/tooltip.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const applyTooltip = (el, bindings, vnode) => {
193193
// Before showing the tooltip, we update the title if it is a function
194194
if (isFunction(config.title)) {
195195
el[BV_TOOLTIP].updateData({
196-
title: config.title()
196+
title: config.title(el)
197197
})
198198
}
199199
})
@@ -225,7 +225,7 @@ const applyTooltip = (el, bindings, vnode) => {
225225
// We only pass data properties that have changed
226226
if (data[prop] !== oldData[prop]) {
227227
// if title is a function, we execute it here
228-
newData[prop] = prop === 'title' && isFunction(data[prop]) ? data[prop]() : data[prop]
228+
newData[prop] = prop === 'title' && isFunction(data[prop]) ? data[prop](el) : data[prop]
229229
}
230230
})
231231
el[BV_TOOLTIP].updateData(newData)

0 commit comments

Comments
 (0)