]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Remove a few unneeded variables
authorXhmikosR <xhmikosr@gmail.com>
Sat, 9 Oct 2021 18:49:49 +0000 (21:49 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Sat, 29 Jan 2022 11:25:30 +0000 (13:25 +0200)
js/src/dom/event-handler.js
js/src/modal.js
js/src/util/focustrap.js

index b9ebce3244adf21795c3b163020cf42e914427ed..64e52ed958445eb3fb927479c19ae995061ec652 100644 (file)
@@ -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
   }
 
index cc158d6ce5291741788ecd78c1f1d193de896c7b..e06cf751649fd6a001d6e96c5bdb64138e33a422 100644 (file)
@@ -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)
 
index 46727ecf8a88f405c9633c7548b9e4eb4b18266b..88fd16b10447b85f9ced36eae60ff91f9612eaa6 100644 (file)
@@ -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
     }