mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
1132b07c53
One of the ivy acceptance tests currently fails in IE10. This is because we recently added a new test that asserts that injecting `ViewRef` results in a `NullInjectorError`. Due to limitations in TypeScript and in polyfills for `setPrototypeOf`, the error cannot be thrown as `ViewRef` is always considered injectable. In reality, `ViewRef` should not be injectable, as explicitly noted in https://github.com/angular/angular/commit/c00f4ab2ae703e8a3ee4a3850170c9bbf0f9bc42. There seems no way to simulate the proper prototype chain in such browsers that do not natively support `__proto__`, so TypeScript and `core-js` polyfills simply break the prototype chain and assign inherited properties directly on `ViewRef`. i.e. so that `ViewRef.__NG_ELEMENT_ID__` exists and DI picks it up. There is a way for TypeScript to theoretically generate proper prototype chain in ES5 output, but they intend to only bother about the proper prototype chain in ES6 where `setPrototypeOf` etc. are offically standarized. See the response: https://github.com/microsoft/TypeScript/issues/1601#issuecomment-94892833. PR Close #37892