diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 505f8c8532..2a55992cba 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -578,14 +578,11 @@ class Tooltip { } _fixTitle() { - const titleType = typeof this.element.getAttribute('data-bs-original-title') - - if (this.element.getAttribute('title') || titleType !== 'string') { - this.element.setAttribute( - 'data-bs-original-title', - this.element.getAttribute('title') || '' - ) + const title = this.element.getAttribute('title') + const originalTitleType = typeof this.element.getAttribute('data-bs-original-title') + if (title || originalTitleType !== 'string') { + this.element.setAttribute('data-bs-original-title', title || '') this.element.setAttribute('title', '') } }