From: XhmikosR Date: Fri, 11 Dec 2020 13:47:34 +0000 (+0200) Subject: Use the ternary operator in a few more places (#32303) X-Git-Tag: v5.0.0-beta2~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d154f0df7fe2d9498b5d0d7342c8650fa52f98e8;p=thirdparty%2Fbootstrap.git Use the ternary operator in a few more places (#32303) --- diff --git a/js/src/carousel.js b/js/src/carousel.js index e1432d924b..b9257bcc9d 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -431,19 +431,9 @@ class Carousel extends BaseComponent { const nextElementIndex = this._getItemIndex(nextElement) const isCycling = Boolean(this._interval) - let directionalClassName - let orderClassName - let eventDirectionName - - if (direction === DIRECTION_NEXT) { - directionalClassName = CLASS_NAME_START - orderClassName = CLASS_NAME_NEXT - eventDirectionName = DIRECTION_LEFT - } else { - directionalClassName = CLASS_NAME_END - orderClassName = CLASS_NAME_PREV - eventDirectionName = DIRECTION_RIGHT - } + const directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END + const orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV + const eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) { this._isSliding = false diff --git a/js/src/tab.js b/js/src/tab.js index c882ecd16a..f1b17ac797 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -81,13 +81,11 @@ class Tab extends BaseComponent { previous = previous[previous.length - 1] } - let hideEvent = null - - if (previous) { - hideEvent = EventHandler.trigger(previous, EVENT_HIDE, { + const hideEvent = previous ? + EventHandler.trigger(previous, EVENT_HIDE, { relatedTarget: this._element - }) - } + }) : + null const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget: previous