mirror of
https://github.com/twbs/bootstrap.git
synced 2025-03-01 01:54:24 +01:00
Carousel: cleanup jQueryInterface
Drop chained else ifs and unused variable. Since we were checking for `typeof config === 'string'` in both places, action was never `_config.slide`.
This commit is contained in:
parent
21fa2cfc12
commit
e77ae50311
@ -442,17 +442,21 @@ class Carousel extends BaseComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const action = typeof config === 'string' ? config : _config.slide
|
|
||||||
|
|
||||||
if (typeof config === 'number') {
|
if (typeof config === 'number') {
|
||||||
data.to(config)
|
data.to(config)
|
||||||
} else if (typeof action === 'string') {
|
return
|
||||||
if (typeof data[action] === 'undefined') {
|
}
|
||||||
throw new TypeError(`No method named "${action}"`)
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
||||||
|
throw new TypeError(`No method named "${config}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
data[action]()
|
data[config]()
|
||||||
} else if (_config.interval && _config.ride) {
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_config.interval && _config.ride) {
|
||||||
data.pause()
|
data.pause()
|
||||||
data.cycle()
|
data.cycle()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user