0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

Return early in more places

This commit is contained in:
XhmikosR 2021-11-09 15:44:14 +02:00
parent 7d3bc44bb0
commit 558002f3dc
2 changed files with 27 additions and 23 deletions

View File

@ -225,7 +225,10 @@ class Carousel extends BaseComponent {
}
const endCallBack = () => {
if (this._config.pause === 'hover') {
if (this._config.pause !== 'hover') {
return
}
// If it's a touch-enabled device, mouseenter/leave are fired as
// part of the mouse compatibility events on first tap - the carousel
// would stop cycling until user tapped out of it;
@ -241,7 +244,6 @@ class Carousel extends BaseComponent {
this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval)
}
}
const swipeConfig = {
leftCallback: () => this._slide(DIRECTION_LEFT),

View File

@ -105,7 +105,10 @@ function bootstrapDelegationHandler(element, selector, fn) {
for (let { target } = event; target && target !== this; target = target.parentNode) {
for (const domElement of domElements) {
if (domElement === target) {
if (domElement !== target) {
continue
}
event.delegateTarget = target
if (handler.oneOff) {
@ -115,7 +118,6 @@ function bootstrapDelegationHandler(element, selector, fn) {
return fn.apply(target, [event])
}
}
}
// To please ESLint
return null