Commit d5683d2
committed
fix($animateCss): ensure that an object is always returned even when no animation is set to run
Before in RC0 and RC1 $animateCss would not return anything if a
CSS-based animation was not detected. This was a messy API decision
which resulted in the user having to have an if statement to handle the
failure case. This patch ensures that an animator object with the start()
and end() functions is always returned. If an animation is not detected
then the preperatory CSS styles and classes are removed immediately and
the element is cleaned up, however a "dump" animator object is still
returned which allows for callbacks and promises to be applied.
The returned object now also contains a `valid` property which can be
examined to determine whether an animation is set to run on the element.
BREAKING CHANGE: The $animateCss service will now always return an
object even if the animation is not set to run. If your code is using
$animateCss then please consider the following code change:
```
// before
var animator = $animateCss(element, { ... });
if (!animator) {
continueApp();
return;
}
var runner = animator.start();
runner.done(continueApp);
runner.then(continueApp);
// now
var animator = $animateCss(element, { ... });
var runner = animator.start();
runner.done(continueApp);
runner.then(continueApp);
```1 parent df24410 commit d5683d2
File tree
5 files changed
+178
-72
lines changed- src/ngAnimate
- test/ngAnimate
5 files changed
+178
-72
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 47 | + | |
52 | 48 | | |
53 | 49 | | |
54 | 50 | | |
| |||
71 | 67 | | |
72 | 68 | | |
73 | 69 | | |
74 | | - | |
| 70 | + | |
75 | 71 | | |
76 | 72 | | |
77 | 73 | | |
78 | 74 | | |
79 | 75 | | |
80 | 76 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 77 | + | |
86 | 78 | | |
87 | 79 | | |
88 | 80 | | |
| |||
122 | 114 | | |
123 | 115 | | |
124 | 116 | | |
125 | | - | |
| 117 | + | |
126 | 118 | | |
127 | 119 | | |
128 | 120 | | |
| 121 | + | |
129 | 122 | | |
130 | 123 | | |
131 | 124 | | |
| |||
158 | 151 | | |
159 | 152 | | |
160 | 153 | | |
161 | | - | |
| 154 | + | |
162 | 155 | | |
163 | 156 | | |
164 | | - | |
| 157 | + | |
165 | 158 | | |
166 | 159 | | |
167 | 160 | | |
| |||
185 | 178 | | |
186 | 179 | | |
187 | 180 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
198 | 184 | | |
199 | | - | |
| 185 | + | |
200 | 186 | | |
201 | 187 | | |
202 | 188 | | |
| |||
223 | 209 | | |
224 | 210 | | |
225 | 211 | | |
226 | | - | |
| 212 | + | |
227 | 213 | | |
228 | 214 | | |
229 | 215 | | |
| |||
538 | 524 | | |
539 | 525 | | |
540 | 526 | | |
541 | | - | |
542 | | - | |
| 527 | + | |
543 | 528 | | |
544 | 529 | | |
545 | 530 | | |
| |||
586 | 571 | | |
587 | 572 | | |
588 | 573 | | |
589 | | - | |
590 | | - | |
| 574 | + | |
591 | 575 | | |
592 | 576 | | |
593 | 577 | | |
| |||
682 | 666 | | |
683 | 667 | | |
684 | 668 | | |
685 | | - | |
686 | | - | |
| 669 | + | |
687 | 670 | | |
688 | 671 | | |
689 | 672 | | |
| |||
711 | 694 | | |
712 | 695 | | |
713 | 696 | | |
| 697 | + | |
714 | 698 | | |
715 | 699 | | |
716 | 700 | | |
| |||
790 | 774 | | |
791 | 775 | | |
792 | 776 | | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
793 | 794 | | |
794 | 795 | | |
795 | 796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
138 | 142 | | |
139 | 143 | | |
140 | 144 | | |
| |||
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
149 | | - | |
| 153 | + | |
150 | 154 | | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
155 | 163 | | |
156 | 164 | | |
157 | 165 | | |
| |||
232 | 240 | | |
233 | 241 | | |
234 | 242 | | |
235 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
236 | 250 | | |
237 | 251 | | |
238 | 252 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
377 | 372 | | |
378 | 373 | | |
379 | 374 | | |
| |||
389 | 384 | | |
390 | 385 | | |
391 | 386 | | |
392 | | - | |
| 387 | + | |
393 | 388 | | |
394 | 389 | | |
395 | 390 | | |
396 | 391 | | |
397 | | - | |
| 392 | + | |
398 | 393 | | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 394 | + | |
404 | 395 | | |
405 | 396 | | |
406 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| 157 | + | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
| |||
190 | 194 | | |
191 | 195 | | |
192 | 196 | | |
| 197 | + | |
193 | 198 | | |
194 | 199 | | |
195 | 200 | | |
| |||
252 | 257 | | |
253 | 258 | | |
254 | 259 | | |
| 260 | + | |
255 | 261 | | |
256 | 262 | | |
257 | 263 | | |
| |||
429 | 435 | | |
430 | 436 | | |
431 | 437 | | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
440 | 445 | | |
441 | 446 | | |
442 | 447 | | |
| |||
0 commit comments