(rejected)
| 1221 | } |
| 1222 | |
| 1223 | function close(rejected) { |
| 1224 | // if the promise has been called already then we shouldn't close |
| 1225 | // the animation again |
| 1226 | if (animationClosed || (animationCompleted && animationPaused)) return; |
| 1227 | animationClosed = true; |
| 1228 | animationPaused = false; |
| 1229 | |
| 1230 | if (!options.$$skipPreparationClasses) { |
| 1231 | $$jqLite.removeClass(element, preparationClasses); |
| 1232 | } |
| 1233 | $$jqLite.removeClass(element, activeClasses); |
| 1234 | |
| 1235 | blockKeyframeAnimations(node, false); |
| 1236 | blockTransitions(node, false); |
| 1237 | |
| 1238 | forEach(temporaryStyles, function(entry) { |
| 1239 | // There is only one way to remove inline style properties entirely from elements. |
| 1240 | // By using `removeProperty` this works, but we need to convert camel-cased CSS |
| 1241 | // styles down to hyphenated values. |
| 1242 | node.style[entry[0]] = ''; |
| 1243 | }); |
| 1244 | |
| 1245 | applyAnimationClasses(element, options); |
| 1246 | applyAnimationStyles(element, options); |
| 1247 | |
| 1248 | if (Object.keys(restoreStyles).length) { |
| 1249 | forEach(restoreStyles, function(value, prop) { |
| 1250 | if (value) { |
| 1251 | node.style.setProperty(prop, value); |
| 1252 | } else { |
| 1253 | node.style.removeProperty(prop); |
| 1254 | } |
| 1255 | }); |
| 1256 | } |
| 1257 | |
| 1258 | // the reason why we have this option is to allow a synchronous closing callback |
| 1259 | // that is fired as SOON as the animation ends (when the CSS is removed) or if |
| 1260 | // the animation never takes off at all. A good example is a leave animation since |
| 1261 | // the element must be removed just after the animation is over or else the element |
| 1262 | // will appear on screen for one animation frame causing an overbearing flicker. |
| 1263 | if (options.onDone) { |
| 1264 | options.onDone(); |
| 1265 | } |
| 1266 | |
| 1267 | if (events && events.length) { |
| 1268 | // Remove the transitionend / animationend listener(s) |
| 1269 | element.off(events.join(' '), onAnimationProgress); |
| 1270 | } |
| 1271 | |
| 1272 | //Cancel the fallback closing timeout and remove the timer data |
| 1273 | var animationTimerData = element.data(ANIMATE_TIMER_KEY); |
| 1274 | if (animationTimerData) { |
| 1275 | $timeout.cancel(animationTimerData[0].timer); |
| 1276 | element.removeData(ANIMATE_TIMER_KEY); |
| 1277 | } |
| 1278 | |
| 1279 | // if the preparation function fails then the promise is not setup |
| 1280 | if (runner) { |
no test coverage detected