1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-27 13:59:06 +02:00

Merge js-components 'transitionend' listener callbacks into one method

This commit is contained in:
GeoSot
2021-04-11 02:27:18 +03:00
committed by Mark Otto
parent 9106d2a0ea
commit 90b1a6907e
9 changed files with 47 additions and 107 deletions

View File

@@ -7,9 +7,7 @@
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement
getElementFromSelector
} from './util/index'
import Data from './dom/data'
import EventHandler from './dom/event-handler'
@@ -75,15 +73,8 @@ class Alert extends BaseComponent {
_removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW)
if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element)
return
}
const transitionDuration = getTransitionDurationFromElement(element)
EventHandler.one(element, 'transitionend', () => this._destroyElement(element))
emulateTransitionEnd(element, transitionDuration)
const isAnimated = element.classList.contains(CLASS_NAME_FADE)
this._queueCallback(() => this._destroyElement(element), element, isAnimated)
}
_destroyElement(element) {