From 2515d9e113eafe965e2101ea6e9b4ac4774aa03c Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 11 Sep 2019 04:22:36 -0300 Subject: [PATCH 1/2] fix(tooltip, popover): check `document.body` instead of `document` for IE11 support (fixes #4074) --- src/components/tooltip/helpers/bv-tooltip.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/tooltip/helpers/bv-tooltip.js b/src/components/tooltip/helpers/bv-tooltip.js index c2e8212eca5..3b583edd656 100644 --- a/src/components/tooltip/helpers/bv-tooltip.js +++ b/src/components/tooltip/helpers/bv-tooltip.js @@ -12,6 +12,7 @@ import { isDisabled, isVisible, closest, + contains, select, getById, hasClass, @@ -204,7 +205,7 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({ this.$nextTick(() => { const target = this.getTarget() - if (target && document.contains(target)) { + if (target && contains(document.body, target)) { // Copy the parent's scoped style attribute this.scopeId = getScopId(this.$parent) // Set up all trigger handlers and listeners @@ -353,7 +354,7 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({ // Show the tooltip const target = this.getTarget() - if (!target || !document.body.contains(target) || !isVisible(target) || this.dropdownOpen()) { + if (!target || !contains(document.body, target) || !isVisible(target) || this.dropdownOpen()) { // If trigger element isn't in the DOM or is not visible, or is on an open dropdown toggle return } @@ -783,13 +784,13 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({ /* istanbul ignore next */ if ( // From tip to target - (tip && tip.contains(evtTarget) && target.contains(relatedTarget)) || + (tip && contains(tip, evtTarget) && contains(target, relatedTarget)) || // From target to tip - (tip && target.contains(evtTarget) && tip.contains(relatedTarget)) || + (tip && contains(target, evtTarget) && contains(tip, relatedTarget)) || // Within tip - (tip && tip.contains(evtTarget) && tip.contains(relatedTarget)) || + (tip && contains(tip, evtTarget) && contains(tip, relatedTarget)) || // Within target - (target.contains(evtTarget) && target.contains(relatedTarget)) + (contains(target, evtTarget) && contains(target, relatedTarget)) ) { // If focus/hover moves within `tip` and `target`, don't trigger a leave return From d0465e8ab6756264834403ab509ff270a8159925 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 11 Sep 2019 04:25:52 -0300 Subject: [PATCH 2/2] lint --- src/components/tooltip/helpers/bv-tooltip.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/tooltip/helpers/bv-tooltip.js b/src/components/tooltip/helpers/bv-tooltip.js index 3b583edd656..e33fb6b88d3 100644 --- a/src/components/tooltip/helpers/bv-tooltip.js +++ b/src/components/tooltip/helpers/bv-tooltip.js @@ -354,7 +354,12 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({ // Show the tooltip const target = this.getTarget() - if (!target || !contains(document.body, target) || !isVisible(target) || this.dropdownOpen()) { + if ( + !target || + !contains(document.body, target) || + !isVisible(target) || + this.dropdownOpen() + ) { // If trigger element isn't in the DOM or is not visible, or is on an open dropdown toggle return }