Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-11-28 04:58:59 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-12-01 19:00:36 +0300
commit8eacbaa08b1b8a5a935fd31368388f3f7e9e25da (patch)
tree43e967cc123b12843ae87cf06bb42d8d4dd8fdc2 /js
parentc69ccba08cd4f16d42bd83ffd40d2a57c9ca0ffc (diff)
Tooltip: merge timeout functionality
Diffstat (limited to 'js')
-rw-r--r--js/src/tooltip.js23
1 files changed, 7 insertions, 16 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 645a6b7e28..35abd29442 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -526,16 +526,9 @@ class Tooltip extends BaseComponent {
return
}
- clearTimeout(this._timeout)
-
this._hoverState = HOVER_STATE_SHOW
- if (!this._config.delay.show) {
- this.show()
- return
- }
-
- this._timeout = setTimeout(() => {
+ this._setTimeout(() => {
if (this._hoverState === HOVER_STATE_SHOW) {
this.show()
}
@@ -547,22 +540,20 @@ class Tooltip extends BaseComponent {
return
}
- clearTimeout(this._timeout)
-
this._hoverState = HOVER_STATE_OUT
- if (!this._config.delay.hide) {
- this.hide()
- return
- }
-
- this._timeout = setTimeout(() => {
+ this._setTimeout(() => {
if (this._hoverState === HOVER_STATE_OUT) {
this.hide()
}
}, this._config.delay.hide)
}
+ _setTimeout(handler, timeout) {
+ clearTimeout(this._timeout)
+ this._timeout = setTimeout(handler, timeout)
+ }
+
_isWithActiveTrigger() {
return Object.values(this._activeTrigger).includes(true)
}