(element, event, options)
| 2094 | }; |
| 2095 | |
| 2096 | function queueAnimation(element, event, options) { |
| 2097 | var node, parent; |
| 2098 | element = stripCommentsFromElement(element); |
| 2099 | if (element) { |
| 2100 | node = getDomNode(element); |
| 2101 | parent = element.parent(); |
| 2102 | } |
| 2103 | |
| 2104 | options = prepareAnimationOptions(options); |
| 2105 | |
| 2106 | // we create a fake runner with a working promise. |
| 2107 | // These methods will become available after the digest has passed |
| 2108 | var runner = new $$AnimateRunner(); |
| 2109 | |
| 2110 | // there are situations where a directive issues an animation for |
| 2111 | // a jqLite wrapper that contains only comment nodes... If this |
| 2112 | // happens then there is no way we can perform an animation |
| 2113 | if (!node) { |
| 2114 | close(); |
| 2115 | return runner; |
| 2116 | } |
| 2117 | |
| 2118 | if (isArray(options.addClass)) { |
| 2119 | options.addClass = options.addClass.join(' '); |
| 2120 | } |
| 2121 | |
| 2122 | if (isArray(options.removeClass)) { |
| 2123 | options.removeClass = options.removeClass.join(' '); |
| 2124 | } |
| 2125 | |
| 2126 | if (options.from && !isObject(options.from)) { |
| 2127 | options.from = null; |
| 2128 | } |
| 2129 | |
| 2130 | if (options.to && !isObject(options.to)) { |
| 2131 | options.to = null; |
| 2132 | } |
| 2133 | |
| 2134 | var className = [node.className, options.addClass, options.removeClass].join(' '); |
| 2135 | if (!isAnimatableClassName(className)) { |
| 2136 | close(); |
| 2137 | return runner; |
| 2138 | } |
| 2139 | |
| 2140 | var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; |
| 2141 | |
| 2142 | // this is a hard disable of all animations for the application or on |
| 2143 | // the element itself, therefore there is no need to continue further |
| 2144 | // past this point if not enabled |
| 2145 | var skipAnimations = !animationsEnabled || disabledElementsLookup.get(node); |
| 2146 | var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {}; |
| 2147 | var hasExistingAnimation = !!existingAnimation.state; |
| 2148 | |
| 2149 | // there is no point in traversing the same collection of parent ancestors if a followup |
| 2150 | // animation will be run on the same element that already did all that checking work |
| 2151 | if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) { |
| 2152 | skipAnimations = !areAnimationsAllowed(element, parent, event); |
| 2153 | } |
no test coverage detected