mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-10 15:44:51 +02:00
Popover - call content
once if it's a function. (#24690)
This commit is contained in:
@@ -124,7 +124,11 @@ const Popover = (($) => {
|
||||
|
||||
// we use append for html objects to maintain js events
|
||||
this.setElementContent($tip.find(Selector.TITLE), this.getTitle())
|
||||
this.setElementContent($tip.find(Selector.CONTENT), this._getContent())
|
||||
let content = this._getContent()
|
||||
if (typeof content === 'function') {
|
||||
content = content.call(this.element)
|
||||
}
|
||||
this.setElementContent($tip.find(Selector.CONTENT), content)
|
||||
|
||||
$tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`)
|
||||
}
|
||||
@@ -133,9 +137,7 @@ const Popover = (($) => {
|
||||
|
||||
_getContent() {
|
||||
return this.element.getAttribute('data-content')
|
||||
|| (typeof this.config.content === 'function' ?
|
||||
this.config.content.call(this.element) :
|
||||
this.config.content)
|
||||
|| this.config.content
|
||||
}
|
||||
|
||||
_cleanTipClass() {
|
||||
|
Reference in New Issue
Block a user