(animationEvent, element, className, styles)
| 1764 | } |
| 1765 | |
| 1766 | function animateSetup(animationEvent, element, className, styles) { |
| 1767 | var structural = ['ng-enter','ng-leave','ng-move'].indexOf(className) >= 0; |
| 1768 | |
| 1769 | var cacheKey = getCacheKey(element); |
| 1770 | var eventCacheKey = cacheKey + ' ' + className; |
| 1771 | var itemIndex = lookupCache[eventCacheKey] ? ++lookupCache[eventCacheKey].total : 0; |
| 1772 | |
| 1773 | var stagger = {}; |
| 1774 | if (itemIndex > 0) { |
| 1775 | var staggerClassName = className + '-stagger'; |
| 1776 | var staggerCacheKey = cacheKey + ' ' + staggerClassName; |
| 1777 | var applyClasses = !lookupCache[staggerCacheKey]; |
| 1778 | |
| 1779 | applyClasses && $$jqLite.addClass(element, staggerClassName); |
| 1780 | |
| 1781 | stagger = getElementAnimationDetails(element, staggerCacheKey); |
| 1782 | |
| 1783 | applyClasses && $$jqLite.removeClass(element, staggerClassName); |
| 1784 | } |
| 1785 | |
| 1786 | $$jqLite.addClass(element, className); |
| 1787 | |
| 1788 | var formerData = element.data(NG_ANIMATE_CSS_DATA_KEY) || {}; |
| 1789 | var timings = getElementAnimationDetails(element, eventCacheKey); |
| 1790 | var transitionDuration = timings.transitionDuration; |
| 1791 | var animationDuration = timings.animationDuration; |
| 1792 | |
| 1793 | if (structural && transitionDuration === 0 && animationDuration === 0) { |
| 1794 | $$jqLite.removeClass(element, className); |
| 1795 | return false; |
| 1796 | } |
| 1797 | |
| 1798 | var blockTransition = styles || (structural && transitionDuration > 0); |
| 1799 | var blockAnimation = animationDuration > 0 && |
| 1800 | stagger.animationDelay > 0 && |
| 1801 | stagger.animationDuration === 0; |
| 1802 | |
| 1803 | var closeAnimationFns = formerData.closeAnimationFns || []; |
| 1804 | element.data(NG_ANIMATE_CSS_DATA_KEY, { |
| 1805 | stagger: stagger, |
| 1806 | cacheKey: eventCacheKey, |
| 1807 | running: formerData.running || 0, |
| 1808 | itemIndex: itemIndex, |
| 1809 | blockTransition: blockTransition, |
| 1810 | closeAnimationFns: closeAnimationFns |
| 1811 | }); |
| 1812 | |
| 1813 | var node = extractElementNode(element); |
| 1814 | |
| 1815 | if (blockTransition) { |
| 1816 | blockTransitions(node, true); |
| 1817 | if (styles) { |
| 1818 | element.css(styles); |
| 1819 | } |
| 1820 | } |
| 1821 | |
| 1822 | if (blockAnimation) { |
| 1823 | blockAnimations(node, true); |
no test coverage detected