Make sure all consumers of the tooltip mixin clean up when unmounted.
This commit is contained in:
@@ -8,6 +8,8 @@ import './tp-tooltip.js';
|
||||
|
||||
/**
|
||||
* Elements implementing this mixin are able to show tooltip on mouse over.
|
||||
* The tooltip is automatically hidden and removed when the element is
|
||||
* disconnected from the DOM.
|
||||
*
|
||||
* ## Example
|
||||
* ```html
|
||||
@@ -52,6 +54,11 @@ export const Tooltip = function(superClass) {
|
||||
return this._tooltip;
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this._hideTooltip();
|
||||
}
|
||||
|
||||
_tooltipChanged(newTooltip, oldTooltip) {
|
||||
if (oldTooltip) {
|
||||
this.removeEventListener('mouseenter', this._showTooltip);
|
||||
|
||||
Reference in New Issue
Block a user