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
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-10-08 12:14:45 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-11-25 20:23:49 +0300
commit91ad255e07d3d16f2ea88ca5b49bbe569ea5e2b4 (patch)
treefa960ab526b40d8ea7d8d0870bb2ed4696743258
parent569bca54d2552b4a1ab39d15f5e4e6108b17d38e (diff)
Change adjustDialog's if conditions to improve readability
-rw-r--r--js/src/modal.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/src/modal.js b/js/src/modal.js
index ecbf5cadca..b8b1447746 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -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`
}
}