aboutsummaryrefslogtreecommitdiff
path: root/js/src/carousel.js
diff options
context:
space:
mode:
authorJohann <[email protected]>2016-12-02 18:52:19 +0100
committerMark Otto <[email protected]>2016-12-02 09:52:19 -0800
commit297c47c3fdbb58e3d9824afdee83ef3c4b9d141a (patch)
treeca90559ff2025eca6400b6b88b3d609d91f9653f /js/src/carousel.js
parent1fb6d8c46a560e2e35295440721ba2929f9721b6 (diff)
downloadbootstrap-297c47c3fdbb58e3d9824afdee83ef3c4b9d141a.tar.xz
bootstrap-297c47c3fdbb58e3d9824afdee83ef3c4b9d141a.zip
[V4] Throw error when a plugin is in transition (#17823)
* Throw error when a plugin is in transition * Add unit tests about plugins in transition
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r--js/src/carousel.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index e56d4f0f2..7fda8f615 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -116,9 +116,10 @@ const Carousel = (($) => {
// public
next() {
- if (!this._isSliding) {
- this._slide(Direction.NEXT)
+ if (this._isSliding) {
+ throw new Error('Carousel is sliding')
}
+ this._slide(Direction.NEXT)
}
nextWhenVisible() {
@@ -129,9 +130,10 @@ const Carousel = (($) => {
}
prev() {
- if (!this._isSliding) {
- this._slide(Direction.PREVIOUS)
+ if (this._isSliding) {
+ throw new Error('Carousel is sliding')
}
+ this._slide(Direction.PREVIOUS)
}
pause(event) {