angular-docs-cn/packages/core/test/acceptance
Andrew Scott 779344012a refactor(core): assert TNode is not a container when setting attribute on element (#37111)
This PR provides a more helpful error than the one currently present:
`el.setAttribute is not a function`. It is not valid to have directives with host bindings
on `ng-template` or `ng-container` nodes. VE would silently ignore this, while Ivy
attempts to set the attribute and throws an error because these are comment nodes
and do not have `setAttribute` functionality.

It is better to throw a helpful error than to silently ignore this because
putting a directive with host binding on an `ng-template` or `ng-container` is most often a mistake.
Developers should be made aware that the host binding will have no effect in these cases.

Note that an error is already thrown in Ivy, as mentioned above, so this
is not a breaking change and can be merged to both master and patch.

Resolves #35994

PR Close #37111
2020-06-08 11:21:05 -07:00
..
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
attributes_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
bootstrap_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
di_spec.ts docs(core): remove v10 mention from @Injectable warning (#37383) 2020-06-02 17:30:58 -04: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 refactor(core): assert TNode is not a container when setting attribute on element (#37111) 2020-06-08 11:21:05 -07:00
i18n_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
lifecycle_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
listener_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ng_module_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ngdevmode_debug_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
outputs_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00