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