@@ -624,18 +624,28 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
624624 // If the target has a `title` attribute,
625625 // remove it and store it on a data attribute
626626 const target = this . getTarget ( )
627- const title = getAttr ( target , 'title' )
628- if ( title ) {
629- setAttr ( target , DATA_TITLE_ATTR , title )
627+ if ( hasAttr ( target , 'title' ) ) {
628+ // Get ` title` attribute value and remove it from target
629+ const title = getAttr ( target , ' title' )
630630 setAttr ( target , 'title' , '' )
631+ // Only set the data attribute when the value is truthy
632+ if ( title ) {
633+ setAttr ( target , DATA_TITLE_ATTR , title )
634+ }
631635 }
632636 } ,
633637 restoreTitle ( ) {
634- // If the target had a title, restore it and remove the data attribute
638+ // If the target had a `title` attribute,
639+ // restore it and remove the data attribute
635640 const target = this . getTarget ( )
636- if ( target && hasAttr ( target , DATA_TITLE_ATTR ) ) {
637- setAttr ( target , 'title' , getAttr ( target , DATA_TITLE_ATTR ) || '' )
641+ if ( hasAttr ( target , DATA_TITLE_ATTR ) ) {
642+ // Get data attribute value and remove it from target
643+ const title = getAttr ( target , DATA_TITLE_ATTR )
638644 removeAttr ( target , DATA_TITLE_ATTR )
645+ // Only restore the `title` attribute when the value is truthy
646+ if ( title ) {
647+ setAttr ( target , 'title' , title )
648+ }
639649 }
640650 } ,
641651 // --- BvEvent helpers ---
0 commit comments