Skip to content

Commit

Permalink
fix(ttoltip popover): prevnt llegal invocation errors when tooltip in…
Browse files Browse the repository at this point in the history
…side `v-if`'ed elements

Prevents illegal invocation errors when tooltip inside `v-if`'ed elements.

Fixes issue  #1032
  • Loading branch information
tmorehouse authored Sep 14, 2017
1 parent d134285 commit eefa864
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions lib/classes/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,38 +291,40 @@ class ToolTip {
}

setWhileOpenListeners(on) {
// Ontouch start listeners
this.setOnTouchStartListener(on);
// Global hide events
this.setRootListener(on);
// Modal close events
this.setModalListener(on);
// Route change events
this.setRouteWatcher(on);
// Periodic $element visibility check
// For handling when tip is in <keepalive>, tabs, carousel, etc
this.visibleCheck(on);
// Route change events
this.setRouteWatcher(on);
// Global hide events
this.setRootListener(on);
// Ontouch start listeners
this.setOnTouchStartListener(on);
}

// force hide of tip (internal method)
forceHide() {
const tip = this.getTipElement();
if (!this.$tip) {
return;
}
// Disable while open listeners/watchers
this.setWhileOpenListeners(false);
// Clear any hover enter/leave event
clearTimeout(this.$hoverTimeout);
this.$hoverTimeout = null;
this.$hoverState = '';
// Remove animation for quicker hide
const initAnimation = this.$config.animation;
this.$config.animation = false;
removeClass(tip, ClassName.FADE);
// Hide the tip
this.hide(null, true);
this.$config.animation = initAnimation;
}

// Hide tooltip
hide(callback, force) {
const tip = this.getTipElement();
const tip = this.$tip;
if (!tip) {
return;
}

// Create a canelable BvEvent
const hideEvt = new BvEvent('hide', {
Expand Down

0 comments on commit eefa864

Please sign in to comment.