From 5c1d683e7175e4009a161a371eb3c919fdd23103 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Wed, 22 Jul 2015 19:40:36 +0200 Subject: [PATCH] Tooltips are now properly hidden if the element is removed from the dom. --- src/UI/Shared/Tooltip.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/UI/Shared/Tooltip.js b/src/UI/Shared/Tooltip.js index db71cdc7c..c19b369fb 100644 --- a/src/UI/Shared/Tooltip.js +++ b/src/UI/Shared/Tooltip.js @@ -19,6 +19,24 @@ Tooltip.prototype.getOptions = function(options) { return result; }; +var onElementRemoved = function(event) { + event.data.hide(); +}; + +var origShow = Tooltip.prototype.show; +Tooltip.prototype.show = function() { + origShow.call(this); + + this.$element.on('remove', this, onElementRemoved); +}; + +var origHide = Tooltip.prototype.hide; +Tooltip.prototype.hide = function() { + origHide.call(this); + + this.$element.off('remove', onElementRemoved); +}; + module.exports = { appInitializer : function() {