(element, event, initialOptions)
| 2438 | return $animate; |
| 2439 | |
| 2440 | function queueAnimation(element, event, initialOptions) { |
| 2441 | // we always make a copy of the options since |
| 2442 | // there should never be any side effects on |
| 2443 | // the input data when running `$animateCss`. |
| 2444 | var options = copy(initialOptions); |
| 2445 | |
| 2446 | var node, parent; |
| 2447 | element = stripCommentsFromElement(element); |
| 2448 | if (element) { |
| 2449 | node = getDomNode(element); |
| 2450 | parent = element.parent(); |
| 2451 | } |
| 2452 | |
| 2453 | options = prepareAnimationOptions(options); |
| 2454 | |
| 2455 | // we create a fake runner with a working promise. |
| 2456 | // These methods will become available after the digest has passed |
| 2457 | var runner = new $$AnimateRunner(); |
| 2458 | |
| 2459 | // this is used to trigger callbacks in postDigest mode |
| 2460 | var runInNextPostDigestOrNow = postDigestTaskFactory(); |
| 2461 | |
| 2462 | if (isArray(options.addClass)) { |
| 2463 | options.addClass = options.addClass.join(' '); |
| 2464 | } |
| 2465 | |
| 2466 | if (options.addClass && !isString(options.addClass)) { |
| 2467 | options.addClass = null; |
| 2468 | } |
| 2469 | |
| 2470 | if (isArray(options.removeClass)) { |
| 2471 | options.removeClass = options.removeClass.join(' '); |
| 2472 | } |
| 2473 | |
| 2474 | if (options.removeClass && !isString(options.removeClass)) { |
| 2475 | options.removeClass = null; |
| 2476 | } |
| 2477 | |
| 2478 | if (options.from && !isObject(options.from)) { |
| 2479 | options.from = null; |
| 2480 | } |
| 2481 | |
| 2482 | if (options.to && !isObject(options.to)) { |
| 2483 | options.to = null; |
| 2484 | } |
| 2485 | |
| 2486 | // there are situations where a directive issues an animation for |
| 2487 | // a jqLite wrapper that contains only comment nodes... If this |
| 2488 | // happens then there is no way we can perform an animation |
| 2489 | if (!node) { |
| 2490 | close(); |
| 2491 | return runner; |
| 2492 | } |
| 2493 | |
| 2494 | var className = [node.className, options.addClass, options.removeClass].join(' '); |
| 2495 | if (!isAnimatableClassName(className)) { |
| 2496 | close(); |
| 2497 | return runner; |
no test coverage detected