angular-docs-cn/packages/platform-browser/animations/src
arturovt c49b28013a fix(animations): cleanup DOM elements when the root view is removed (#41059)
Currently, when importing `BrowserAnimationsModule`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

BREAKING CHANGE:
DOM elements are now correctly removed when the root view is removed.
If you are using SSR and use the app's HTML for rendering, you will need
to ensure that you save the HTML to a variable before destorying the
app.
It is also possible that tests could be accidentally relying on the old behavior by
trying to find an element that was not removed in a previous test. If
this is the case, the failing tests should be updated to ensure they
have proper setup code which initializes elements they rely on.

PR Close #41059
2021-03-22 12:58:11 -07:00
..
animation_builder.ts fix(animations): implement getPosition in browser animation builder (#39983) 2020-12-08 16:24:41 -08:00
animation_renderer.ts fix(core): Store ICU state in `LView` rather than in `TView` (#39233) 2020-10-21 18:33:00 -07:00
animations.ts feat(animations): add support for disabling animations through BrowserAnimationsModule.withConfig (#40731) 2021-02-24 15:08:27 -08:00
module.ts feat(animations): add support for disabling animations through BrowserAnimationsModule.withConfig (#40731) 2021-02-24 15:08:27 -08:00
private_export.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
providers.ts fix(animations): cleanup DOM elements when the root view is removed (#41059) 2021-03-22 12:58:11 -07:00