tooltip: move repeated strings to constants

This commit is contained in:
XhmikosR 2020-12-02 16:25:34 +02:00
parent 1798dfcce7
commit 98e9388800

View file

@ -111,6 +111,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'
@ -220,7 +223,7 @@ class Tooltip extends BaseComponent {
clearTimeout(this._timeout)
EventHandler.off(this._element, this.constructor.EVENT_KEY)
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.parentNode) {
this.tip.parentNode.removeChild(this.tip)
@ -560,7 +563,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 = {