From cbef410e3fb00a45022d931dd58a3c6832b96d01 Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Thu, 1 Oct 2020 19:14:38 -0700 Subject: [PATCH] refactor(elements): remove code to support IE9/10 (#39090) Since support for IE 9 and IE 10 browsers is removed in v11, the code that was added to support these browsers is no longer needed. PR Close #39090 --- .../elements/src/create-custom-element.ts | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/packages/elements/src/create-custom-element.ts b/packages/elements/src/create-custom-element.ts index 6c29a45a7d..ffe0f00409 100644 --- a/packages/elements/src/create-custom-element.ts +++ b/packages/elements/src/create-custom-element.ts @@ -157,18 +157,9 @@ export function createCustomElement

( string, any ] => [propName, (this as any)[propName]]); - // In some browsers (e.g. IE10), `Object.setPrototypeOf()` (which is required by some Custom - // Elements polyfills) is not defined and is thus polyfilled in a way that does not preserve - // the prototype chain. In such cases, `this` will not be an instance of `NgElementImpl` and - // thus not have the component input getters/setters defined on `NgElementImpl.prototype`. - if (!(this instanceof NgElementImpl)) { - // Add getters and setters to the instance itself for each property input. - defineInputGettersSetters(inputs, this); - } else { - // Delete the property from the instance, so that it can go through the getters/setters - // set on `NgElementImpl.prototype`. - preExistingValues.forEach(([propName]) => delete (this as any)[propName]); - } + // Delete the property from the instance, so that it can go through the getters/setters + // set on `NgElementImpl.prototype`. + preExistingValues.forEach(([propName]) => delete (this as any)[propName]); // Re-apply pre-existing values through the strategy. preExistingValues.forEach(([propName, value]) => strategy.setInputValue(propName, value)); @@ -237,16 +228,6 @@ export function createCustomElement

( } } - // TypeScript 3.9+ defines getters/setters as configurable but non-enumerable properties (in - // compliance with the spec). This breaks emulated inheritance in ES5 on environments that do not - // natively support `Object.setPrototypeOf()` (such as IE 9-10). - // Update the property descriptor of `NgElementImpl#ngElementStrategy` to make it enumerable. - // The below 'const', shouldn't be needed but currently this breaks build-optimizer - // Build-optimizer currently uses TypeScript 3.6 which is unable to resolve an 'accessor' - // in 'getTypeOfVariableOrParameterOrPropertyWorker'. - const getterName = 'ngElementStrategy'; - Object.defineProperty(NgElementImpl.prototype, getterName, {enumerable: true}); - // Add getters and setters to the prototype for each property input. defineInputGettersSetters(inputs, NgElementImpl.prototype);