angular-cn/packages/core/test/acceptance
Kristiyan Kostadinov b015d3e950 fix(core): not inserting ViewContainerRef nodes when inside root of a component (#39599)
When a `ViewContainerRef` is injected, we dynamically create a comment node next to the host
so that it can be used as an anchor point for inserting views. The comment node is inserted
through the `appendChild` helper from `node_manipulation.ts` in most cases.

The problem with using `appendChild` here is that it has some extra logic which doesn't return
a parent `RNode` if an element is at the root of a component. I __think__ that this is a performance
optimization which is used to avoid inserting an element in one place in the DOM and then
moving it a bit later when it is projected. This can break down in some cases when creating
a `ViewContainerRef` for a non-component node at the root of another component like the following:

```
<root>
  <div #viewContainerRef></div>
</root>
```

In this case the `#viewContainerRef` node is at the root of a component so we intentionally don't
insert it, but since its anchor element was created manually, it'll never be projected. This will
prevent any views added through the `ViewContainerRef` from being inserted into the DOM.

These changes resolve the issue by not going through `appendChild` at all when creating a comment
node for `ViewContainerRef`. This should work identically since `appendChild` doesn't really do
anything with the T structures anyway, it only uses them to reach the relevant DOM nodes.

Fixes #39556.

PR Close #39599
2020-11-12 11:37:00 -08:00
..
BUILD.bazel refactor(core): add debug ranges to `LViewDebug` with matchers (#38359) 2020-08-06 16:58:11 -07:00
attributes_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
bootstrap_spec.ts fix(core): cleanup DOM elements when root view is removed (#37600) 2020-06-25 14:34:35 -07:00
change_detection_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
change_detection_transplanted_view_spec.ts fix(core): clear the `RefreshTransplantedView` when detached (#38768) 2020-09-10 09:11:38 -07:00
common_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_spec.ts fix(core): not inserting ViewContainerRef nodes when inside root of a component (#39599) 2020-11-12 11:37:00 -08:00
content_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
copy_definition_feature_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
debug_spec.ts refactor(core): Create `TNodeType.Text` to display full template in `TView` debug (#39233) 2020-10-21 18:33:00 -07:00
di_spec.ts fix(core): Access injected parent values using SelfSkip (#39464) 2020-11-06 09:23:45 -08:00
directive_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
discover_utils_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
embedded_views_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
exports_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
host_binding_spec.ts test(core): remove code specific to IE 9 and IE 10 (#39090) 2020-10-13 15:51:48 -07:00
i18n_spec.ts fix(compiler): treat i18n attributes with no bindings as static attributes (#39408) 2020-10-27 13:31:29 -07:00
inherit_definition_feature_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
integration_spec.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
lifecycle_spec.ts fix(core): Allow modification of lifecycle hooks any time before bootstrap (#35464) 2020-07-15 16:22:46 -07:00
listener_spec.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
ng_module_spec.ts fix(core): incorrectly validating properties on ng-content and ng-container (#37773) 2020-07-15 12:39:39 -07:00
ngdevmode_debug_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ngmodule_scope_spec.ts fix(core): prevent NgModule scope being overwritten in JIT compiler (#37795) 2020-08-11 09:50:27 -07:00
outputs_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts fix(compiler): evaluate safe navigation expressions in correct binding order (#37911) 2020-08-11 09:51:10 -07:00
property_binding_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
property_interpolation_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
providers_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
pure_function_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
query_spec.ts fix(core): queries not matching string injection tokens (#38321) 2020-08-10 15:27:24 -07:00
renderer_factory_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
router_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
styling_spec.ts fix(core): handle !important in style property value (#39603) 2020-11-12 09:11:18 -08:00
template_ref_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
text_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
view_container_ref_spec.ts fix(core): fix multiple nested views removal from ViewContainerRef (#38317) 2020-08-13 13:35:53 -07:00
view_insertion_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
view_ref_spec.ts fix(core): error when invoking callbacks registered via ViewRef.onDestroy (#37543) 2020-06-26 15:02:41 -07:00