mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-30 22:52: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') {
|
||||
data.to(config)
|
||||
} else if (typeof action === 'string') {
|
||||
if (typeof data[action] === 'undefined') {
|
||||
throw new TypeError(`No method named "${action}"`)
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
||||
throw new TypeError(`No method named "${config}"`)
|
||||
}
|
||||
|
||||
data[action]()
|
||||
} else if (_config.interval && _config.ride) {
|
||||
data[config]()
|
||||
return
|
||||
}
|
||||
|
||||
if (_config.interval && _config.ride) {
|
||||
data.pause()
|
||||
data.cycle()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user