mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-26 05:19:15 +02:00
Use the ternary operator in a few more places (#32303)
This commit is contained in:
@@ -431,19 +431,9 @@ class Carousel extends BaseComponent {
|
|||||||
const nextElementIndex = this._getItemIndex(nextElement)
|
const nextElementIndex = this._getItemIndex(nextElement)
|
||||||
const isCycling = Boolean(this._interval)
|
const isCycling = Boolean(this._interval)
|
||||||
|
|
||||||
let directionalClassName
|
const directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END
|
||||||
let orderClassName
|
const orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV
|
||||||
let eventDirectionName
|
const eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
|
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
|
||||||
this._isSliding = false
|
this._isSliding = false
|
||||||
|
@@ -81,13 +81,11 @@ class Tab extends BaseComponent {
|
|||||||
previous = previous[previous.length - 1]
|
previous = previous[previous.length - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
let hideEvent = null
|
const hideEvent = previous ?
|
||||||
|
EventHandler.trigger(previous, EVENT_HIDE, {
|
||||||
if (previous) {
|
|
||||||
hideEvent = EventHandler.trigger(previous, EVENT_HIDE, {
|
|
||||||
relatedTarget: this._element
|
relatedTarget: this._element
|
||||||
})
|
}) :
|
||||||
}
|
null
|
||||||
|
|
||||||
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
|
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
|
||||||
relatedTarget: previous
|
relatedTarget: previous
|
||||||
|
Reference in New Issue
Block a user