]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
tooltip: move repeated strings to constants (#34619)
authorXhmikosR <xhmikosr@gmail.com>
Thu, 29 Jul 2021 22:32:07 +0000 (01:32 +0300)
committerGitHub <noreply@github.com>
Thu, 29 Jul 2021 22:32:07 +0000 (00:32 +0200)
js/src/tooltip.js

index 0adde623fb56c3859635a34fee1bbf869ecf5c46..f932a9ff995e8f6012fa9f5d1607dd39aa4851d9 100644 (file)
@@ -108,6 +108,9 @@ const HOVER_STATE_SHOW = 'show'
 const HOVER_STATE_OUT = 'out'
 
 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'
+const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`
+
+const EVENT_MODAL_HIDE = 'hide.bs.modal'
 
 const TRIGGER_HOVER = 'hover'
 const TRIGGER_FOCUS = 'focus'
@@ -202,7 +205,7 @@ class Tooltip extends BaseComponent {
   dispose() {
     clearTimeout(this._timeout)
 
-    EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler)
+    EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)
 
     if (this.tip) {
       this.tip.remove()
@@ -545,7 +548,7 @@ class Tooltip extends BaseComponent {
       }
     }
 
-    EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler)
+    EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)
 
     if (this._config.selector) {
       this._config = {