]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
tooltip dispose:removing only own event handler (#28896)
authordavid-lallement <51702439+david-lallement@users.noreply.github.com>
Thu, 13 Jun 2019 08:42:54 +0000 (10:42 +0200)
committerJohann-S <johann.servoire@gmail.com>
Thu, 13 Jun 2019 08:42:54 +0000 (10:42 +0200)
js/src/tooltip.js

index 7b792bc711cde283c6b378673c42b9e63f441328..6cca7d75a4a8f57e04390c77726ac767dfe3d321 100644 (file)
@@ -237,7 +237,7 @@ class Tooltip {
     Data.removeData(this.element, this.constructor.DATA_KEY)
 
     EventHandler.off(this.element, this.constructor.EVENT_KEY)
-    EventHandler.off(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal')
+    EventHandler.off(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler)
 
     if (this.tip) {
       this.tip.parentNode.removeChild(this.tip)
@@ -558,13 +558,15 @@ class Tooltip {
       }
     })
 
+    this._hideModalHandler = () => {
+      if (this.element) {
+        this.hide()
+      }
+    }
+
     EventHandler.on(SelectorEngine.closest(this.element, '.modal'),
       'hide.bs.modal',
-      () => {
-        if (this.element) {
-          this.hide()
-        }
-      }
+      this._hideModalHandler
     )
 
     if (this.config.selector) {