vendor/assets/javascripts/angular-animate.js in angularjs-rails-1.4.7 vs vendor/assets/javascripts/angular-animate.js in angularjs-rails-1.4.8

- old
+ new

@@ -1,7 +1,7 @@ /** - * @license AngularJS v1.4.7 + * @license AngularJS v1.4.8 * (c) 2010-2015 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; @@ -620,10 +620,12 @@ * @param {DOMElement} element the element that will be animated * @param {object} options the animation-related options that will be applied during the animation * * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.) + * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and + * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted. * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both). * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`). * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`). * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation. * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. @@ -2131,19 +2133,22 @@ function normalizeAnimationOptions(element, options) { return mergeAnimationOptions(element, options, {}); } - function findCallbacks(element, event) { + function findCallbacks(parent, element, event) { var targetNode = getDomNode(element); + var targetParentNode = getDomNode(parent); var matches = []; var entries = callbackRegistry[event]; if (entries) { forEach(entries, function(entry) { if (entry.node.contains(targetNode)) { matches.push(entry.callback); + } else if (event === 'leave' && entry.node.contains(targetParentNode)) { + matches.push(entry.callback); } }); } return matches; @@ -2465,11 +2470,11 @@ return runner; function notifyProgress(runner, event, phase, data) { runInNextPostDigestOrNow(function() { - var callbacks = findCallbacks(element, event); + var callbacks = findCallbacks(parent, element, event); if (callbacks.length) { // do not optimize this call here to RAF because // we don't know how heavy the callback code here will // be and if this code is buffered then this can // lead to a performance regression. @@ -3456,11 +3461,11 @@ * * leave: function(element, doneFn) { * jQuery(element).fadeOut(1000, doneFn); * } * } - * }] + * }]); * ``` * * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as * greensock.js and velocity.js. * @@ -3487,11 +3492,11 @@ * }, * setClass: function(element, addedClass, removedClass, doneFn) { * // do some cool animation and call the doneFn * } * } - * }] + * }]); * ``` * * ## CSS + JS Animations Together * * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular, @@ -3509,11 +3514,11 @@ * return { * enter: function(element, doneFn) { * jQuery(element).slideIn(1000, doneFn); * } * } - * }] + * }]); * ``` * * ```css * .slide.ng-enter { * transition:0.5s linear all; @@ -3529,20 +3534,19 @@ * our own JS-based animation code: * * ```js * myModule.animation('.slide', ['$animateCss', function($animateCss) { * return { - * enter: function(element, doneFn) { + * enter: function(element) { * // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`. - * var runner = $animateCss(element, { + * return $animateCss(element, { * event: 'enter', * structural: true - * }).start(); -* runner.done(doneFn); + * }); * } * } - * }] + * }]); * ``` * * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. * * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or @@ -3550,22 +3554,20 @@ * data into `$animateCss` directly: * * ```js * myModule.animation('.slide', ['$animateCss', function($animateCss) { * return { - * enter: function(element, doneFn) { - * var runner = $animateCss(element, { + * enter: function(element) { + * return $animateCss(element, { * event: 'enter', * structural: true, * addClass: 'maroon-setting', * from: { height:0 }, * to: { height: 200 } - * }).start(); - * - * runner.done(doneFn); + * }); * } * } - * }] + * }]); * ``` * * Now we can fill in the rest via our transition CSS code: * * ```css