0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Tweak methods

Name them to be more descriptive and have agnostic functionality
This commit is contained in:
GeoSot 2021-10-08 02:27:00 +03:00 committed by XhmikosR
parent 79e01c3bad
commit fc33ce4b46

View File

@ -120,8 +120,8 @@ class Modal extends BaseComponent {
this._adjustDialog()
this._setEscapeEvent()
this._setResizeEvent()
this._toggleEscapeEventListener(true)
this._toggleResizeEventListener(true)
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
@ -148,8 +148,8 @@ class Modal extends BaseComponent {
this._isShown = false
this._isTransitioning = true
this._setEscapeEvent()
this._setResizeEvent()
this._toggleEscapeEventListener(false)
this._toggleResizeEventListener(false)
this._focustrap.deactivate()
@ -234,8 +234,8 @@ class Modal extends BaseComponent {
this._queueCallback(transitionComplete, this._dialog, this._isAnimated())
}
_setEscapeEvent() {
if (!this._isShown) {
_toggleEscapeEventListener(enable) {
if (!enable) {
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS)
return
}
@ -255,8 +255,8 @@ class Modal extends BaseComponent {
})
}
_setResizeEvent() {
if (this._isShown) {
_toggleResizeEventListener(enable) {
if (enable) {
EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog())
return
}