@@ -12,6 +12,7 @@ import {
1212 isDisabled ,
1313 isVisible ,
1414 closest ,
15+ contains ,
1516 select ,
1617 getById ,
1718 hasClass ,
@@ -204,7 +205,7 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
204205
205206 this . $nextTick ( ( ) => {
206207 const target = this . getTarget ( )
207- if ( target && document . contains ( target ) ) {
208+ if ( target && contains ( document . body , target ) ) {
208209 // Copy the parent's scoped style attribute
209210 this . scopeId = getScopId ( this . $parent )
210211 // Set up all trigger handlers and listeners
@@ -353,7 +354,12 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
353354 // Show the tooltip
354355 const target = this . getTarget ( )
355356
356- if ( ! target || ! document . body . contains ( target ) || ! isVisible ( target ) || this . dropdownOpen ( ) ) {
357+ if (
358+ ! target ||
359+ ! contains ( document . body , target ) ||
360+ ! isVisible ( target ) ||
361+ this . dropdownOpen ( )
362+ ) {
357363 // If trigger element isn't in the DOM or is not visible, or is on an open dropdown toggle
358364 return
359365 }
@@ -783,13 +789,13 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
783789 /* istanbul ignore next */
784790 if (
785791 // From tip to target
786- ( tip && tip . contains ( evtTarget ) && target . contains ( relatedTarget ) ) ||
792+ ( tip && contains ( tip , evtTarget ) && contains ( target , relatedTarget ) ) ||
787793 // From target to tip
788- ( tip && target . contains ( evtTarget ) && tip . contains ( relatedTarget ) ) ||
794+ ( tip && contains ( target , evtTarget ) && contains ( tip , relatedTarget ) ) ||
789795 // Within tip
790- ( tip && tip . contains ( evtTarget ) && tip . contains ( relatedTarget ) ) ||
796+ ( tip && contains ( tip , evtTarget ) && contains ( tip , relatedTarget ) ) ||
791797 // Within target
792- ( target . contains ( evtTarget ) && target . contains ( relatedTarget ) )
798+ ( contains ( target , evtTarget ) && contains ( target , relatedTarget ) )
793799 ) {
794800 // If focus/hover moves within `tip` and `target`, don't trigger a leave
795801 return
0 commit comments