(element, options)
| 824 | } |
| 825 | |
| 826 | function init(element, options) { |
| 827 | var node = getDomNode(element); |
| 828 | if (!node || !node.parentNode) { |
| 829 | return closeAndReturnNoopAnimator(); |
| 830 | } |
| 831 | |
| 832 | options = prepareAnimationOptions(options); |
| 833 | |
| 834 | var temporaryStyles = []; |
| 835 | var classes = element.attr('class'); |
| 836 | var styles = packageStyles(options); |
| 837 | var animationClosed; |
| 838 | var animationPaused; |
| 839 | var animationCompleted; |
| 840 | var runner; |
| 841 | var runnerHost; |
| 842 | var maxDelay; |
| 843 | var maxDelayTime; |
| 844 | var maxDuration; |
| 845 | var maxDurationTime; |
| 846 | |
| 847 | if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) { |
| 848 | return closeAndReturnNoopAnimator(); |
| 849 | } |
| 850 | |
| 851 | var method = options.event && isArray(options.event) |
| 852 | ? options.event.join(' ') |
| 853 | : options.event; |
| 854 | |
| 855 | var isStructural = method && options.structural; |
| 856 | var structuralClassName = ''; |
| 857 | var addRemoveClassName = ''; |
| 858 | |
| 859 | if (isStructural) { |
| 860 | structuralClassName = pendClasses(method, 'ng-', true); |
| 861 | } else if (method) { |
| 862 | structuralClassName = method; |
| 863 | } |
| 864 | |
| 865 | if (options.addClass) { |
| 866 | addRemoveClassName += pendClasses(options.addClass, '-add'); |
| 867 | } |
| 868 | |
| 869 | if (options.removeClass) { |
| 870 | if (addRemoveClassName.length) { |
| 871 | addRemoveClassName += ' '; |
| 872 | } |
| 873 | addRemoveClassName += pendClasses(options.removeClass, '-remove'); |
| 874 | } |
| 875 | |
| 876 | // there may be a situation where a structural animation is combined together |
| 877 | // with CSS classes that need to resolve before the animation is computed. |
| 878 | // However this means that there is no explicit CSS code to block the animation |
| 879 | // from happening (by setting 0s none in the class name). If this is the case |
| 880 | // we need to apply the classes before the first rAF so we know to continue if |
| 881 | // there actually is a detected transition or keyframe animation |
| 882 | if (options.applyClassesEarly && addRemoveClassName.length) { |
| 883 | applyAnimationClasses(element, options); |
nothing calls this directly
no test coverage detected