(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback)
| 825 | and the onComplete callback will be fired once the animation is fully complete. |
| 826 | */ |
| 827 | function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) { |
| 828 | |
| 829 | var runner = animationRunner(element, animationEvent, className); |
| 830 | if(!runner) { |
| 831 | fireDOMOperation(); |
| 832 | fireBeforeCallbackAsync(); |
| 833 | fireAfterCallbackAsync(); |
| 834 | closeAnimation(); |
| 835 | return; |
| 836 | } |
| 837 | |
| 838 | className = runner.className; |
| 839 | var elementEvents = angular.element._data(runner.node); |
| 840 | elementEvents = elementEvents && elementEvents.events; |
| 841 | |
| 842 | if (!parentElement) { |
| 843 | parentElement = afterElement ? afterElement.parent() : element.parent(); |
| 844 | } |
| 845 | |
| 846 | var ngAnimateState = element.data(NG_ANIMATE_STATE) || {}; |
| 847 | var runningAnimations = ngAnimateState.active || {}; |
| 848 | var totalActiveAnimations = ngAnimateState.totalActive || 0; |
| 849 | var lastAnimation = ngAnimateState.last; |
| 850 | |
| 851 | //only allow animations if the currently running animation is not structural |
| 852 | //or if there is no animation running at all |
| 853 | var skipAnimations; |
| 854 | if (runner.isClassBased) { |
| 855 | skipAnimations = ngAnimateState.running || |
| 856 | ngAnimateState.disabled || |
| 857 | (lastAnimation && !lastAnimation.isClassBased); |
| 858 | } |
| 859 | |
| 860 | //skip the animation if animations are disabled, a parent is already being animated, |
| 861 | //the element is not currently attached to the document body or then completely close |
| 862 | //the animation if any matching animations are not found at all. |
| 863 | //NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case an animation was found. |
| 864 | if (skipAnimations || animationsDisabled(element, parentElement)) { |
| 865 | fireDOMOperation(); |
| 866 | fireBeforeCallbackAsync(); |
| 867 | fireAfterCallbackAsync(); |
| 868 | closeAnimation(); |
| 869 | return; |
| 870 | } |
| 871 | |
| 872 | var skipAnimation = false; |
| 873 | if(totalActiveAnimations > 0) { |
| 874 | var animationsToCancel = []; |
| 875 | if(!runner.isClassBased) { |
| 876 | if(animationEvent == 'leave' && runningAnimations['ng-leave']) { |
| 877 | skipAnimation = true; |
| 878 | } else { |
| 879 | //cancel all animations when a structural animation takes place |
| 880 | for(var klass in runningAnimations) { |
| 881 | animationsToCancel.push(runningAnimations[klass]); |
| 882 | cleanup(element, klass); |
| 883 | } |
| 884 | runningAnimations = {}; |
no test coverage detected