diff options
| author | Chris Rebert <[email protected]> | 2015-10-02 01:18:16 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2015-10-02 01:18:16 -0700 |
| commit | 10f6e97ec2c59cbeb3c892936e8b7cb3faa1e247 (patch) | |
| tree | deb94d828c341c1cfe61cf0435bb2f2d21836a21 /js/src/carousel.js | |
| parent | a89bfc65252f648469e84242289b8a45a49d08e9 (diff) | |
| parent | 21a65f181eebc3f2c0cd43fb3383ee3de673745b (diff) | |
| download | bootstrap-10f6e97ec2c59cbeb3c892936e8b7cb3faa1e247.tar.xz bootstrap-10f6e97ec2c59cbeb3c892936e8b7cb3faa1e247.zip | |
Merge pull request #17616 from Johann-S/ThrowError
Fix #17612: Throw explicit error when a nonexistent method is invoked
Diffstat (limited to 'js/src/carousel.js')
| -rw-r--r-- | js/src/carousel.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index efacd9494..d8da854a2 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -390,10 +390,11 @@ const Carousel = (($) => { if (typeof config === 'number') { data.to(config) - - } else if (action) { + } else if (typeof action === 'string') { + if (data[action] === undefined) { + throw new Error(`No method named "${action}"`) + } data[action]() - } else if (_config.interval) { data.pause() data.cycle() |
