1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-07 06:06:47 +02: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._adjustDialog()
this._setEscapeEvent() this._toggleEscapeEventListener(true)
this._setResizeEvent() this._toggleResizeEventListener(true)
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => { EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => { EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
@@ -148,8 +148,8 @@ class Modal extends BaseComponent {
this._isShown = false this._isShown = false
this._isTransitioning = true this._isTransitioning = true
this._setEscapeEvent() this._toggleEscapeEventListener(false)
this._setResizeEvent() this._toggleResizeEventListener(false)
this._focustrap.deactivate() this._focustrap.deactivate()
@@ -234,8 +234,8 @@ class Modal extends BaseComponent {
this._queueCallback(transitionComplete, this._dialog, this._isAnimated()) this._queueCallback(transitionComplete, this._dialog, this._isAnimated())
} }
_setEscapeEvent() { _toggleEscapeEventListener(enable) {
if (!this._isShown) { if (!enable) {
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS) EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS)
return return
} }
@@ -255,8 +255,8 @@ class Modal extends BaseComponent {
}) })
} }
_setResizeEvent() { _toggleResizeEventListener(enable) {
if (this._isShown) { if (enable) {
EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog()) EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog())
return return
} }