(element, event, initialOptions)
| 2416 | }; |
| 2417 | |
| 2418 | function queueAnimation(element, event, initialOptions) { |
| 2419 | // we always make a copy of the options since |
| 2420 | // there should never be any side effects on |
| 2421 | // the input data when running `$animateCss`. |
| 2422 | var options = copy(initialOptions); |
| 2423 | |
| 2424 | var node, parent; |
| 2425 | element = stripCommentsFromElement(element); |
| 2426 | if (element) { |
| 2427 | node = getDomNode(element); |
| 2428 | parent = element.parent(); |
| 2429 | } |
| 2430 | |
| 2431 | options = prepareAnimationOptions(options); |
| 2432 | |
| 2433 | // we create a fake runner with a working promise. |
| 2434 | // These methods will become available after the digest has passed |
| 2435 | var runner = new $$AnimateRunner(); |
| 2436 | |
| 2437 | // this is used to trigger callbacks in postDigest mode |
| 2438 | var runInNextPostDigestOrNow = postDigestTaskFactory(); |
| 2439 | |
| 2440 | if (isArray(options.addClass)) { |
| 2441 | options.addClass = options.addClass.join(' '); |
| 2442 | } |
| 2443 | |
| 2444 | if (options.addClass && !isString(options.addClass)) { |
| 2445 | options.addClass = null; |
| 2446 | } |
| 2447 | |
| 2448 | if (isArray(options.removeClass)) { |
| 2449 | options.removeClass = options.removeClass.join(' '); |
| 2450 | } |
| 2451 | |
| 2452 | if (options.removeClass && !isString(options.removeClass)) { |
| 2453 | options.removeClass = null; |
| 2454 | } |
| 2455 | |
| 2456 | if (options.from && !isObject(options.from)) { |
| 2457 | options.from = null; |
| 2458 | } |
| 2459 | |
| 2460 | if (options.to && !isObject(options.to)) { |
| 2461 | options.to = null; |
| 2462 | } |
| 2463 | |
| 2464 | // there are situations where a directive issues an animation for |
| 2465 | // a jqLite wrapper that contains only comment nodes... If this |
| 2466 | // happens then there is no way we can perform an animation |
| 2467 | if (!node) { |
| 2468 | close(); |
| 2469 | return runner; |
| 2470 | } |
| 2471 | |
| 2472 | var className = [node.className, options.addClass, options.removeClass].join(' '); |
| 2473 | if (!isAnimatableClassName(className)) { |
| 2474 | close(); |
| 2475 | return runner; |
no test coverage detected