1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-14 09:34:36 +02:00

refactor(Modal): add _isTransitioning default value

Having variables initialised from start `_isTransitioning` is better.
Would be better to add an eslint rule to check for undeclared variables use.
Reordered enter checks for `show` and `hide` by priority.
This commit is contained in:
Andrew Luca
2018-10-17 02:57:04 +03:00
committed by Johann-S
parent 2b21657cd4
commit 65dc8c9070

View File

@@ -81,6 +81,7 @@ class Modal {
this._isShown = false this._isShown = false
this._isBodyOverflowing = false this._isBodyOverflowing = false
this._ignoreBackdropClick = false this._ignoreBackdropClick = false
this._isTransitioning = false
this._scrollbarWidth = 0 this._scrollbarWidth = 0
} }
@@ -101,7 +102,7 @@ class Modal {
} }
show(relatedTarget) { show(relatedTarget) {
if (this._isTransitioning || this._isShown) { if (this._isShown || this._isTransitioning) {
return return
} }
@@ -153,7 +154,7 @@ class Modal {
event.preventDefault() event.preventDefault()
} }
if (this._isTransitioning || !this._isShown) { if (!this._isShown || this._isTransitioning) {
return return
} }
@@ -206,6 +207,7 @@ class Modal {
this._isShown = null this._isShown = null
this._isBodyOverflowing = null this._isBodyOverflowing = null
this._ignoreBackdropClick = null this._ignoreBackdropClick = null
this._isTransitioning = null
this._scrollbarWidth = null this._scrollbarWidth = null
} }