mirror of https://github.com/twbs/bootstrap.git
Remove a few unneeded variables
This commit is contained in:
parent
2964c12bb9
commit
0c3dfe104b
|
@ -123,9 +123,7 @@ function bootstrapDelegationHandler(element, selector, fn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findHandler(events, handler, delegationSelector = null) {
|
function findHandler(events, handler, delegationSelector = null) {
|
||||||
const uidEventList = Object.keys(events)
|
for (const uidEvent of Object.keys(events)) {
|
||||||
|
|
||||||
for (const uidEvent of uidEventList) {
|
|
||||||
const event = events[uidEvent]
|
const event = events[uidEvent]
|
||||||
|
|
||||||
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
|
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
|
||||||
|
@ -140,9 +138,8 @@ function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
||||||
const delegation = typeof handler === 'string'
|
const delegation = typeof handler === 'string'
|
||||||
const originalHandler = delegation ? delegationFn : handler
|
const originalHandler = delegation ? delegationFn : handler
|
||||||
let typeEvent = getTypeEvent(originalTypeEvent)
|
let typeEvent = getTypeEvent(originalTypeEvent)
|
||||||
const isNative = nativeEvents.has(typeEvent)
|
|
||||||
|
|
||||||
if (!isNative) {
|
if (!nativeEvents.has(typeEvent)) {
|
||||||
typeEvent = originalTypeEvent
|
typeEvent = originalTypeEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,23 +279,22 @@ class Modal extends BaseComponent {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { classList, scrollHeight, style } = this._element
|
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight
|
||||||
const isModalOverflowing = scrollHeight > document.documentElement.clientHeight
|
const initialOverflowY = this._element.style.overflowY
|
||||||
const initialOverflowY = style.overflowY
|
|
||||||
// return if the following background transition hasn't yet completed
|
// return if the following background transition hasn't yet completed
|
||||||
if (initialOverflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
|
if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isModalOverflowing) {
|
if (!isModalOverflowing) {
|
||||||
style.overflowY = 'hidden'
|
this._element.style.overflowY = 'hidden'
|
||||||
}
|
}
|
||||||
|
|
||||||
classList.add(CLASS_NAME_STATIC)
|
this._element.classList.add(CLASS_NAME_STATIC)
|
||||||
this._queueCallback(() => {
|
this._queueCallback(() => {
|
||||||
classList.remove(CLASS_NAME_STATIC)
|
this._element.classList.remove(CLASS_NAME_STATIC)
|
||||||
this._queueCallback(() => {
|
this._queueCallback(() => {
|
||||||
style.overflowY = initialOverflowY
|
this._element.style.overflowY = initialOverflowY
|
||||||
}, this._dialog)
|
}, this._dialog)
|
||||||
}, this._dialog)
|
}, this._dialog)
|
||||||
|
|
||||||
|
|
|
@ -60,14 +60,12 @@ class FocusTrap extends Config {
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
activate() {
|
activate() {
|
||||||
const { trapElement, autofocus } = this._config
|
|
||||||
|
|
||||||
if (this._isActive) {
|
if (this._isActive) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autofocus) {
|
if (this._config.autofocus) {
|
||||||
trapElement.focus()
|
this._config.trapElement.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop
|
EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop
|
||||||
|
@ -88,10 +86,9 @@ class FocusTrap extends Config {
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
_handleFocusin(event) {
|
_handleFocusin(event) {
|
||||||
const { target } = event
|
|
||||||
const { trapElement } = this._config
|
const { trapElement } = this._config
|
||||||
|
|
||||||
if (target === document || target === trapElement || trapElement.contains(target)) {
|
if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue