mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-29 06:49:06 +02:00
[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
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user