]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Change adjustDialog's if conditions to improve readability
authorGeoSot <geo.sotis@gmail.com>
Fri, 8 Oct 2021 09:14:45 +0000 (12:14 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Thu, 25 Nov 2021 17:23:49 +0000 (19:23 +0200)
js/src/modal.js

index ecbf5cadca70e17c0da20f27aedb5ab4883cb522..b8b1447746b4fa80c75e535b7d75ac7a00665acc 100644 (file)
@@ -326,12 +326,14 @@ class Modal extends BaseComponent {
     const scrollbarWidth = this._scrollBar.getWidth()
     const isBodyOverflowing = scrollbarWidth > 0
 
-    if ((!isBodyOverflowing && isModalOverflowing && !isRTL()) || (isBodyOverflowing && !isModalOverflowing && isRTL())) {
-      this._element.style.paddingLeft = `${scrollbarWidth}px`
+    if (isBodyOverflowing && !isModalOverflowing) {
+      const property = isRTL() ? 'paddingLeft' : 'paddingRight'
+      this._element.style[property] = `${scrollbarWidth}px`
     }
 
-    if ((isBodyOverflowing && !isModalOverflowing && !isRTL()) || (!isBodyOverflowing && isModalOverflowing && isRTL())) {
-      this._element.style.paddingRight = `${scrollbarWidth}px`
+    if (!isBodyOverflowing && isModalOverflowing) {
+      const property = isRTL() ? 'paddingRight' : 'paddingLeft'
+      this._element.style[property] = `${scrollbarWidth}px`
     }
   }