function applyTransitionClass (el, stage, changeState, hasAnimation) {

    if (!endEvents.trans) {
        changeState()
        return codes.CSS_SKIP
    }

    // if the browser supports transition,
    // it must have classList...
    var onEnd,
        classList        = el.classList,
        existingCallback = el.vue_trans_cb,
        enterClass       = config.enterClass,
        leaveClass       = config.leaveClass,
        endEvent         = hasAnimation ? endEvents.anim : endEvents.trans

    // cancel unfinished callbacks and jobs
    if (existingCallback) {
        el.removeEventListener(endEvent, existingCallback)
        classList.remove(enterClass)
        classList.remove(leaveClass)
        el.vue_trans_cb = null
    }

    if (stage > 0) { // enter

        // set to enter state before appending
        classList.add(enterClass)
        // append
        changeState()
        // trigger transition
        if (!hasAnimation) {
            batcher.push({
                execute: function () {
                    classList.remove(enterClass)
                }
            })
        } else {
            onEnd = function (e) {
                if (e.target === el) {
                    el.removeEventListener(endEvent, onEnd)
                    el.vue_trans_cb = null
                    classList.remove(enterClass)
                }
            }
            el.addEventListener(endEvent, onEnd)
            el.vue_trans_cb = onEnd
        }
        return codes.CSS_E

    } else { // leave

        if (el.offsetWidth || el.offsetHeight) {
            // trigger hide transition
            classList.add(leaveClass)
            onEnd = function (e) {
                if (e.target === el) {
                    el.removeEventListener(endEvent, onEnd)
                    el.vue_trans_cb = null
                    // actually remove node here
                    changeState()
                    classList.remove(leaveClass)
                }
            }
            // attach transition end listener
            el.addEventListener(endEvent, onEnd)
            el.vue_trans_cb = onEnd
        } else {
            // directly remove invisible elements
            changeState()
        }
        return codes.CSS_L
        
    }

}
/**
 *  Togggle a CSS class to trigger transition
 */
Togggle a CSS class to trigger transition
Togggle a CSS class to trigger transition
function applyTransitionClass (el, stage, changeState, hasAnimation) {
    if (!endEvents.trans) {
        changeState()
        return codes.CSS_SKIP
    }
    var onEnd,
        classList        = el.classList,
        existingCallback = el.vue_trans_cb,
        enterClass       = config.enterClass,
        leaveClass       = config.leaveClass,
        endEvent         = hasAnimation ? endEvents.anim : endEvents.trans
    if (existingCallback) {
        el.removeEventListener(endEvent, existingCallback)
        classList.remove(enterClass)
        classList.remove(leaveClass)
        el.vue_trans_cb = null
    }
    if (stage > 0) { 
        classList.add(enterClass)
        changeState()
        if (!hasAnimation) {
            batcher.push({
                execute: function () {
                    classList.remove(enterClass)
                }
            })
        } else {
            onEnd = function (e) {
                if (e.target === el) {
                    el.removeEventListener(endEvent, onEnd)
                    el.vue_trans_cb = null
                    classList.remove(enterClass)
                }
            }
            el.addEventListener(endEvent, onEnd)
            el.vue_trans_cb = onEnd
        }
        return codes.CSS_E
    } else { 
        if (el.offsetWidth || el.offsetHeight) {
            classList.add(leaveClass)
            onEnd = function (e) {
                if (e.target === el) {
                    el.removeEventListener(endEvent, onEnd)
                    el.vue_trans_cb = null
                    changeState()
                    classList.remove(leaveClass)
                }
            }
            el.addEventListener(endEvent, onEnd)
            el.vue_trans_cb = onEnd
        } else {
            changeState()
        }
        return codes.CSS_L
    }
}
function applyTransitionClass ( el , stage , changeState , hasAnimation ) { if ( ! endEvents . trans ) { changeState ( ) return codes . CSS_SKIP } var onEnd , classList = el . classList , existingCallback = el . vue_trans_cb , enterClass = config . enterClass , leaveClass = config . leaveClass , endEvent = hasAnimation ? endEvents . anim : endEvents . trans if ( existingCallback ) { el . removeEventListener ( endEvent , existingCallback ) classList . remove ( enterClass ) classList . remove ( leaveClass ) el . vue_trans_cb = null } if ( stage > 0 ) { classList . add ( enterClass ) changeState ( ) if ( ! hasAnimation ) { batcher . push ( { execute : function ( ) { classList . remove ( enterClass ) } } ) } else { onEnd = function ( e ) { if ( e . target === el ) { el . removeEventListener ( endEvent , onEnd ) el . vue_trans_cb = null classList . remove ( enterClass ) } } el . addEventListener ( endEvent , onEnd ) el . vue_trans_cb = onEnd } return codes . CSS_E } else { if ( el . offsetWidth || el . offsetHeight ) { classList . add ( leaveClass ) onEnd = function ( e ) { if ( e . target === el ) { el . removeEventListener ( endEvent , onEnd ) el . vue_trans_cb = null changeState ( ) classList . remove ( leaveClass ) } } el . addEventListener ( endEvent , onEnd ) el . vue_trans_cb = onEnd } else { changeState ( ) } return codes . CSS_L } }
Togggle a CSS class to trigger transition
Togggle a CSS class to trigger transition
// if the browser supports transition, // it must have classList... // cancel unfinished callbacks and jobs // enter // set to enter state before appending // append // trigger transition // leave // trigger hide transition // actually remove node here // attach transition end listener // directly remove invisible elements