|
174 | 174 | * a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits
|
175 | 175 | * the element's CSS class attribute value and then run the matching animation event function (if found).
|
176 | 176 | * In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function
|
177 |
| - * be executed. It should be also noted that only simple or compound class selectors are allowed. |
| 177 | + * be executed. It should be also noted that only simple class selectors are allowed. |
178 | 178 | *
|
179 | 179 | * Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.
|
180 | 180 | * As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run,
|
@@ -211,27 +211,23 @@ angular.module('ngAnimate', ['ng'])
|
211 | 211 | $rootElement.data(NG_ANIMATE_STATE, rootAnimateState);
|
212 | 212 |
|
213 | 213 | function lookup(name) {
|
214 |
| - var i, ii; |
215 | 214 | if (name) {
|
216 |
| - var classes = name.substr(1).split('.'), |
217 |
| - classMap = {}; |
218 |
| - |
219 |
| - for (i = 0, ii = classes.length; i < ii; i++) { |
220 |
| - classMap[classes[i]] = true; |
221 |
| - } |
222 |
| - |
223 |
| - var matches = []; |
224 |
| - for (i = 0, ii = selectors.length; i < ii; i++) { |
225 |
| - var selectorFactory = selectors[i]; |
226 |
| - var found = true; |
227 |
| - for(var j = 0, jj = selectorFactory.selectors.length; j < jj; j++) { |
228 |
| - var klass = selectorFactory.selectors[j]; |
229 |
| - if(klass.length > 0) { |
230 |
| - found = found && classMap[klass]; |
231 |
| - } |
232 |
| - } |
233 |
| - if(found) { |
234 |
| - matches.push($injector.get(selectorFactory.name)); |
| 215 | + var matches = [], |
| 216 | + flagMap = {}, |
| 217 | + classes = name.substr(1).split('.'); |
| 218 | + |
| 219 | + //the empty string value is the default animation |
| 220 | + //operation which performs CSS transition and keyframe |
| 221 | + //animations sniffing. This is always included for each |
| 222 | + //element animation procedure |
| 223 | + classes.push(''); |
| 224 | + |
| 225 | + for(var i=0; i < classes.length; i++) { |
| 226 | + var klass = classes[i], |
| 227 | + selectorFactoryName = selectors[klass]; |
| 228 | + if(selectorFactoryName && !flagMap[klass]) { |
| 229 | + matches.push($injector.get(selectorFactoryName)); |
| 230 | + flagMap[klass] = true; |
235 | 231 | }
|
236 | 232 | }
|
237 | 233 | return matches;
|
@@ -444,8 +440,8 @@ angular.module('ngAnimate', ['ng'])
|
444 | 440 | and the onComplete callback will be fired once the animation is fully complete.
|
445 | 441 | */
|
446 | 442 | function performAnimation(event, className, element, parent, after, onComplete) {
|
447 |
| - var classes = ((element.attr('class') || '') + ' ' + className), |
448 |
| - animationLookup = (' ' + classes).replace(/\s+/g,'.'), |
| 443 | + var classes = (element.attr('class') || '') + ' ' + className; |
| 444 | + var animationLookup = (' ' + classes).replace(/\s+/g,'.'), |
449 | 445 | animations = [];
|
450 | 446 | forEach(lookup(animationLookup), function(animation, index) {
|
451 | 447 | animations.push({
|
|
0 commit comments