(rejected)
| 1196 | } |
| 1197 | |
| 1198 | function close(rejected) { |
| 1199 | // if the promise has been called already then we shouldn't close |
| 1200 | // the animation again |
| 1201 | if (animationClosed || (animationCompleted && animationPaused)) return; |
| 1202 | animationClosed = true; |
| 1203 | animationPaused = false; |
| 1204 | |
| 1205 | if (preparationClasses && !options.$$skipPreparationClasses) { |
| 1206 | $$jqLite.removeClass(element, preparationClasses); |
| 1207 | } |
| 1208 | |
| 1209 | if (activeClasses) { |
| 1210 | $$jqLite.removeClass(element, activeClasses); |
| 1211 | } |
| 1212 | |
| 1213 | blockKeyframeAnimations(node, false); |
| 1214 | helpers.blockTransitions(node, false); |
| 1215 | |
| 1216 | forEach(temporaryStyles, function(entry) { |
| 1217 | // There is only one way to remove inline style properties entirely from elements. |
| 1218 | // By using `removeProperty` this works, but we need to convert camel-cased CSS |
| 1219 | // styles down to hyphenated values. |
| 1220 | node.style[entry[0]] = ''; |
| 1221 | }); |
| 1222 | |
| 1223 | applyAnimationClasses(element, options); |
| 1224 | applyAnimationStyles(element, options); |
| 1225 | |
| 1226 | if (Object.keys(restoreStyles).length) { |
| 1227 | forEach(restoreStyles, function(value, prop) { |
| 1228 | if (value) { |
| 1229 | node.style.setProperty(prop, value); |
| 1230 | } else { |
| 1231 | node.style.removeProperty(prop); |
| 1232 | } |
| 1233 | }); |
| 1234 | } |
| 1235 | |
| 1236 | // the reason why we have this option is to allow a synchronous closing callback |
| 1237 | // that is fired as SOON as the animation ends (when the CSS is removed) or if |
| 1238 | // the animation never takes off at all. A good example is a leave animation since |
| 1239 | // the element must be removed just after the animation is over or else the element |
| 1240 | // will appear on screen for one animation frame causing an overbearing flicker. |
| 1241 | if (options.onDone) { |
| 1242 | options.onDone(); |
| 1243 | } |
| 1244 | |
| 1245 | if (events && events.length) { |
| 1246 | // Remove the transitionend / animationend listener(s) |
| 1247 | element.off(events.join(' '), onAnimationProgress); |
| 1248 | } |
| 1249 | |
| 1250 | //Cancel the fallback closing timeout and remove the timer data |
| 1251 | var animationTimerData = element.data(ANIMATE_TIMER_KEY); |
| 1252 | if (animationTimerData) { |
| 1253 | $timeout.cancel(animationTimerData[0].timer); |
| 1254 | element.removeData(ANIMATE_TIMER_KEY); |
| 1255 | } |
no test coverage detected