aboutsummaryrefslogtreecommitdiff
path: root/js/src/collapse.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/collapse.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/collapse.js')
-rw-r--r--js/src/collapse.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js
index ebc3e24cf..1e4730ff7 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -112,8 +112,11 @@ const Collapse = (($) => {
}
show() {
- if (this._isTransitioning ||
- $(this._element).hasClass(ClassName.ACTIVE)) {
+ if (this._isTransitioning) {
+ throw new Error('Collapse is transitioning')
+ }
+
+ if ($(this._element).hasClass(ClassName.ACTIVE)) {
return
}
@@ -193,8 +196,11 @@ const Collapse = (($) => {
}
hide() {
- if (this._isTransitioning ||
- !$(this._element).hasClass(ClassName.ACTIVE)) {
+ if (this._isTransitioning) {
+ throw new Error('Collapse is transitioning')
+ }
+
+ if (!$(this._element).hasClass(ClassName.ACTIVE)) {
return
}