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:
authorXhmikosR <xhmikosr@gmail.com>2021-10-09 21:49:49 +0300
committerXhmikosR <xhmikosr@gmail.com>2022-01-29 14:25:30 +0300
commit0c3dfe104b520d6ce466f265bf60c6d74785972e (patch)
tree278d1f279237b31fdc373aa93fb539a923e00506 /js
parent2964c12bb91b3a252aecbe1bc4041020e4efd622 (diff)
Remove a few unneeded variables
Diffstat (limited to 'js')
-rw-r--r--js/src/dom/event-handler.js7
-rw-r--r--js/src/modal.js15
-rw-r--r--js/src/util/focustrap.js9
3 files changed, 12 insertions, 19 deletions
diff --git a/js/src/dom/event-handler.js b/js/src/dom/event-handler.js
index b9ebce3244..64e52ed958 100644
--- a/js/src/dom/event-handler.js
+++ b/js/src/dom/event-handler.js
@@ -123,9 +123,7 @@ function bootstrapDelegationHandler(element, selector, fn) {
}
function findHandler(events, handler, delegationSelector = null) {
- const uidEventList = Object.keys(events)
-
- for (const uidEvent of uidEventList) {
+ for (const uidEvent of Object.keys(events)) {
const event = events[uidEvent]
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
@@ -140,9 +138,8 @@ function normalizeParams(originalTypeEvent, handler, delegationFn) {
const delegation = typeof handler === 'string'
const originalHandler = delegation ? delegationFn : handler
let typeEvent = getTypeEvent(originalTypeEvent)
- const isNative = nativeEvents.has(typeEvent)
- if (!isNative) {
+ if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent
}
diff --git a/js/src/modal.js b/js/src/modal.js
index cc158d6ce5..e06cf75164 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -279,23 +279,22 @@ class Modal extends BaseComponent {
return
}
- const { classList, scrollHeight, style } = this._element
- const isModalOverflowing = scrollHeight > document.documentElement.clientHeight
- const initialOverflowY = style.overflowY
+ const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight
+ const initialOverflowY = this._element.style.overflowY
// 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
}
if (!isModalOverflowing) {
- style.overflowY = 'hidden'
+ this._element.style.overflowY = 'hidden'
}
- classList.add(CLASS_NAME_STATIC)
+ this._element.classList.add(CLASS_NAME_STATIC)
this._queueCallback(() => {
- classList.remove(CLASS_NAME_STATIC)
+ this._element.classList.remove(CLASS_NAME_STATIC)
this._queueCallback(() => {
- style.overflowY = initialOverflowY
+ this._element.style.overflowY = initialOverflowY
}, this._dialog)
}, this._dialog)
diff --git a/js/src/util/focustrap.js b/js/src/util/focustrap.js
index 46727ecf8a..88fd16b104 100644
--- a/js/src/util/focustrap.js
+++ b/js/src/util/focustrap.js
@@ -60,14 +60,12 @@ class FocusTrap extends Config {
// Public
activate() {
- const { trapElement, autofocus } = this._config
-
if (this._isActive) {
return
}
- if (autofocus) {
- trapElement.focus()
+ if (this._config.autofocus) {
+ this._config.trapElement.focus()
}
EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop
@@ -88,10 +86,9 @@ class FocusTrap extends Config {
// Private
_handleFocusin(event) {
- const { target } = event
const { trapElement } = this._config
- if (target === document || target === trapElement || trapElement.contains(target)) {
+ if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
return
}