This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Commit b16d747
committed
fix(ngAnimate): ensure that parent class-based animations are never closed by their children
This fix ensures that a structural child animation will never close a
parent class based early so that the CSS classes for the child are ready
for it to perform its CSS animation. The reasoning for the past for this
was because their is a one frame delay before the classes were applied.
If a parent and a child animation happen at the same time then the
animations may not be picked up for the element since the CSS classes
may not have been applied yet.
This fix ensures that parent CSS classes are applied in a synchronous
manner without the need to run a one RAF wait. The solution to this was
to apply the preparation classes during the pre-digest phase and then
apply the CSS classes right after with a forced reflow paint.
BREAKING CHANGE: CSS classes added/removed by ngAnimate are now applied
synchronously once the first digest has passed.
The previous behavior involved ngAnimate having to wait for one
requestAnimationFrame before CSS classes were added/removed. The CSS classes
are now applied directly after the first digest that is triggered after
`$animate.addClass`, `$animate.removeClass` or `$animate.setClass` is
called. If any of your code relies on waiting for one frame before
checking for CSS classes on the element then please change this
behavior. If a parent class-based animation, however, is run through a
JavaScript animation which triggers an animation for `beforeAddClass`
and/or `beforeRemoveClass` then the CSS classes will not be applied
in time for the children (and the parent class-based animation will not
be cancelled by any child animations).
Closes #11975
Closes #122761 parent 171e397 commit b16d747
File tree
11 files changed
+873
-259
lines changed- src/ngAnimate
- test/ngAnimate
11 files changed
+873
-259
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
26 | 47 | | |
27 | 48 | | |
28 | 49 | | |
| |||
38 | 59 | | |
39 | 60 | | |
40 | 61 | | |
41 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
42 | 70 | | |
43 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | 211 | | |
251 | 212 | | |
252 | 213 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 214 | + | |
| 215 | + | |
260 | 216 | | |
261 | 217 | | |
262 | 218 | | |
| |||
274 | 230 | | |
275 | 231 | | |
276 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
277 | 242 | | |
278 | 243 | | |
279 | 244 | | |
| |||
330 | 295 | | |
331 | 296 | | |
332 | 297 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | 298 | | |
365 | 299 | | |
366 | 300 | | |
| |||
392 | 326 | | |
393 | 327 | | |
394 | 328 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
| 329 | + | |
| 330 | + | |
399 | 331 | | |
400 | 332 | | |
401 | 333 | | |
| |||
452 | 384 | | |
453 | 385 | | |
454 | 386 | | |
455 | | - | |
456 | 387 | | |
457 | 388 | | |
458 | 389 | | |
| |||
465 | 396 | | |
466 | 397 | | |
467 | 398 | | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
477 | 402 | | |
478 | 403 | | |
479 | 404 | | |
480 | 405 | | |
481 | | - | |
| 406 | + | |
482 | 407 | | |
483 | 408 | | |
484 | 409 | | |
| |||
534 | 459 | | |
535 | 460 | | |
536 | 461 | | |
537 | | - | |
| 462 | + | |
538 | 463 | | |
539 | 464 | | |
540 | 465 | | |
541 | 466 | | |
542 | 467 | | |
543 | | - | |
| 468 | + | |
544 | 469 | | |
545 | 470 | | |
546 | 471 | | |
547 | 472 | | |
548 | 473 | | |
549 | 474 | | |
550 | | - | |
| 475 | + | |
551 | 476 | | |
552 | 477 | | |
553 | 478 | | |
| |||
563 | 488 | | |
564 | 489 | | |
565 | 490 | | |
566 | | - | |
| 491 | + | |
567 | 492 | | |
568 | 493 | | |
569 | 494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
174 | | - | |
| 175 | + | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
222 | 224 | | |
223 | 225 | | |
224 | 226 | | |
225 | | - | |
| 227 | + | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
229 | 240 | | |
230 | | - | |
231 | | - | |
232 | | - | |
| 241 | + | |
233 | 242 | | |
234 | 243 | | |
235 | 244 | | |
236 | 245 | | |
237 | | - | |
238 | | - | |
| 246 | + | |
239 | 247 | | |
240 | 248 | | |
241 | | - | |
242 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
243 | 261 | | |
244 | 262 | | |
245 | 263 | | |
| |||
0 commit comments