mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-06 13:46:42 +02:00
Tooltip: remove title attribute before show & add tests (#35456)
This commit is contained in:
@@ -394,7 +394,7 @@ class Tooltip extends BaseComponent {
|
||||
}
|
||||
|
||||
_getTitle() {
|
||||
return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('title')
|
||||
return this._config.title
|
||||
}
|
||||
|
||||
// Private
|
||||
@@ -510,11 +510,17 @@ class Tooltip extends BaseComponent {
|
||||
}
|
||||
|
||||
_fixTitle() {
|
||||
const title = this._element.getAttribute('title')
|
||||
const title = this._config.originalTitle
|
||||
|
||||
if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
|
||||
if (!title) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!this._element.getAttribute('aria-label') && !this._element.textContent) {
|
||||
this._element.setAttribute('aria-label', title)
|
||||
}
|
||||
|
||||
this._element.removeAttribute('title')
|
||||
}
|
||||
|
||||
_enter() {
|
||||
@@ -579,6 +585,8 @@ class Tooltip extends BaseComponent {
|
||||
}
|
||||
}
|
||||
|
||||
config.originalTitle = this._element.getAttribute('title') || ''
|
||||
config.title = this._resolvePossibleFunction(config.title) || config.originalTitle
|
||||
if (typeof config.title === 'number') {
|
||||
config.title = config.title.toString()
|
||||
}
|
||||
|
Reference in New Issue
Block a user