mirror of
https://github.com/angular/angular.git
synced 2026-11-23 07:05:14 -05:00
Previously, the template type checker assumed that if any directive matched an element node, the element itself did not need DOM schema validation because it was assumed to be either a component or a custom element tag like <router-outlet>. However, if an unknown custom element tag (such as <tn-uploader>) is only matched by attribute directives (e.g. [formControl]), the tag name remains unclaimed and is missing its corresponding component import. In this case, the compiler failed to emit a SCHEMA_INVALID_ELEMENT diagnostic. This commit updates the element validation condition in the type checker to verify the element tag name against the DOM schema unless the element matches an Angular component or a directive whose selector explicitly matches the tag name. By default this check will be disabled to prevent a breaking change in v22.3. You can enable it with `strictUnknownElementWithDirectives: true`. In v23 `strictUnknownElementWithDirectives` will be enabled by default. Related to #46351