diff options
| author | GeoSot <[email protected]> | 2021-10-08 12:14:45 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2021-11-25 19:23:49 +0200 |
| commit | 91ad255e07d3d16f2ea88ca5b49bbe569ea5e2b4 (patch) | |
| tree | fa960ab526b40d8ea7d8d0870bb2ed4696743258 /js | |
| parent | 569bca54d2552b4a1ab39d15f5e4e6108b17d38e (diff) | |
| download | bootstrap-91ad255e07d3d16f2ea88ca5b49bbe569ea5e2b4.tar.xz bootstrap-91ad255e07d3d16f2ea88ca5b49bbe569ea5e2b4.zip | |
Change adjustDialog's if conditions to improve readability
Diffstat (limited to 'js')
| -rw-r--r-- | js/src/modal.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index ecbf5cadc..b8b144774 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` } } |
