mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-28 20:52:21 +01:00
Move transition end detection to dom/event.js instead of util.js
This commit is contained in:
parent
fb465c4745
commit
8d34bc136b
@ -22,46 +22,6 @@ function toType(obj) {
|
||||
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase()
|
||||
}
|
||||
|
||||
function getSpecialTransitionEndEvent() {
|
||||
return {
|
||||
bindType: TRANSITION_END,
|
||||
delegateType: TRANSITION_END,
|
||||
handle(event) {
|
||||
if ($(event.target).is(this)) {
|
||||
return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params
|
||||
}
|
||||
return undefined // eslint-disable-line no-undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function transitionEndEmulator(duration) {
|
||||
let called = false
|
||||
|
||||
$(this).one(Util.TRANSITION_END, () => {
|
||||
called = true
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
if (!called) {
|
||||
Util.triggerTransitionEnd(this)
|
||||
}
|
||||
}, duration)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
function setTransitionEndSupport() {
|
||||
$.fn.emulateTransitionEnd = transitionEndEmulator
|
||||
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Public Util Api
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const Util = {
|
||||
|
||||
TRANSITION_END: 'bsTransitionEnd',
|
||||
|
Loading…
x
Reference in New Issue
Block a user