-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(elements): do not break when the constructor of an Angular Elemen…
…t is not called (#36114) (#37226) Previously, the correct behavior of Angular custom elements relied on the constructor being called (and thus the `injector` property being initialized). However, some polyfills (e.g. `document-register-element`) do not call the constructor of custom elements, which resulted in the `injector` property being undefined and the `NgElementStrategy` failing to be instantiated. This commit fixes it by being tolerant to the `injector` property being undefined and falling back to the injector passed to the `createCustomElement()` config. NOTE: We don't have proper tests exercising the situation where the constructor is not called. For now this is tested using a Google internal test suite (which is how this issue was caught). This commit also adds a rudimentary unit test to emulate this situation. PR Close #36114 PR Close #37226
- Loading branch information
Showing
2 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters