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