angular/packages/core/test
Alan Agius 02d5e8d79d fix(platform-browser): remove styles from DOM of destroyed components (#48298)
Currently style of components using `encapsulation`, `None` or `Emulated` will not be removed from the DOM once the component get destroyed.

This change addresses this by keeping track of the number of times a component is rendered, when the component is destroyed the counter is decreased and once this reaches zero the style element is removed from the DOM.

Currently, this new behaviour is on opt-in bases, but it will be changed in the next major version.

To opt-in, set the `REMOVE_STYLES_ON_COMPONENT_DESTROY` DI token to `true`.

Example
```ts
@NgModule({
 declarations: [
   AppComponent,
 ],
 imports: [
   BrowserModule
 ],
 providers: [
   { provide: REMOVE_STYLES_ON_COMPONENT_DESTROY, useValue: true }
 ],
 bootstrap: [AppComponent]
})
export class AppModule { }
```

Closes #16670

PR Close #48298
2023-02-16 15:31:24 -08:00
..
acceptance fix(compiler): incorrect code when non-null assertion is used after a safe access (#48801) 2023-01-25 18:31:37 +00:00
animation fix(animations): fix non-animatable warnings for easing (#48583) 2023-01-26 22:03:07 +00:00
bundling fix(platform-browser): remove styles from DOM of destroyed components (#48298) 2023-02-16 15:31:24 -08:00
change_detection refactor(core): remove duplicated code in change_detection_util (#45599) 2022-04-12 22:26:09 +00:00
compiler build: ensure bootstrap transitive runfiles are made available (#48521) 2022-12-19 19:50:41 +00:00
debug feat(core): triggerEventHandler accept optional eventObj (#45279) 2022-03-09 13:51:54 -08:00
di refactor(core): cleanup type any (#48623) 2023-01-04 12:15:16 -08:00
dom refactor(core): cleanup type any (#48623) 2023-01-04 12:15:16 -08:00
i18n build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
linker refactor(core): cleanup type any (#48623) 2023-01-04 12:15:16 -08:00
metadata build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
reflection refactor(core): remove unused logic from reflection capabilities (#45335) 2022-03-24 11:02:39 -07:00
render3 fix(platform-browser): remove styles from DOM of destroyed components (#48298) 2023-02-16 15:31:24 -08:00
sanitization docs: extract XSS security doc URL into a constant (#48082) 2022-11-17 13:21:16 -08:00
strict_types refactor(core): rename ...WithMeta types to ...Declaration and alias to unknown (#41119) 2021-03-22 08:57:18 -07:00
testability test(core): reset Testability getter after each test (#45947) 2022-05-10 16:02:53 -07:00
util refactor(core): remove several private utils and APIs (#48357) 2022-12-05 14:35:08 -08:00
zone refactor: adjust packages/core/test to work with ESM (#48521) 2022-12-19 19:50:42 +00:00
application_init_spec.ts test(core): refactor ApplicationInitStatus tests to avoid TestBed side-effects (#33222) 2021-02-22 08:41:49 -08:00
application_module_spec.ts test(core): fix a crosstalk issue with locale ids (#45626) 2022-04-18 09:28:42 -07:00
application_ref_integration_spec.ts refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00
application_ref_spec.ts docs: add NG0403.md for Bootstrapped NgModule doesn't specify which component to initialize error (#48483) 2023-01-04 09:59:24 -08:00
BUILD.bazel build: bundle tests for karma web test suites (#48521) 2022-12-19 19:50:42 +00:00
component_fixture_spec.ts feat(core): update reference and doc to change async to waitAsync. (#37583) 2020-08-03 12:54:13 -07:00
dev_mode_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
directive_lifecycle_integration_spec.ts refactor(core): cleanup type any (#48623) 2023-01-04 12:15:16 -08:00
error_handler_spec.ts refactor(core): remove unused error handler logic (#46216) 2022-06-02 13:40:16 -07:00
event_emitter_spec.ts refactor(core): cleanup type any (#48623) 2023-01-04 12:15:16 -08:00
fake_async_spec.ts refactor(core): cleanup type any (#48623) 2023-01-04 12:15:16 -08:00
forward_ref_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
runtime_error_spec.ts refactor(core): split RuntimeError unit test up (#46239) 2022-06-06 10:12:06 -07:00
test_bed_spec.ts fix(common): Fix TestBed.overrideProvider type to include multi (#48424) 2022-12-12 09:40:22 -08:00
util_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00