diff --git a/build-system/global-configs/experiments-config.json b/build-system/global-configs/experiments-config.json index 87bf4d4f9bda..f061431de029 100644 --- a/build-system/global-configs/experiments-config.json +++ b/build-system/global-configs/experiments-config.json @@ -1,12 +1,5 @@ { "experimentA": {}, "experimentB": {}, - "experimentC": { - "name": "Native Custom Elements V1", - "environment": "AMP", - "command": "gulp dist --defineExperimentConstant=NATIVE_CUSTOM_ELEMENTS_V1", - "issue": "https://github.com/ampproject/amphtml/issues/17243", - "expirationDateUTC": "2020-01-01", - "defineExperimentConstant": "NATIVE_CUSTOM_ELEMENTS_V1" - } + "experimentC": {} } diff --git a/src/friendly-iframe-embed.js b/src/friendly-iframe-embed.js index 95a5d4360448..0e6a3071d8b0 100644 --- a/src/friendly-iframe-embed.js +++ b/src/friendly-iframe-embed.js @@ -866,10 +866,7 @@ function installPolyfillsInChildWindow(parentWin, childWin) { installDOMTokenList(childWin); // The anonymous class parameter allows us to detect native classes vs // transpiled classes. - installCustomElements( - childWin, - NATIVE_CUSTOM_ELEMENTS_V1 ? class {} : undefined - ); + installCustomElements(childWin, class {}); } /** diff --git a/src/polyfills.js b/src/polyfills.js index 33dcda59261e..9aa164b8e1b0 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -41,7 +41,7 @@ if (self.document) { installGetBoundingClientRect(self); // The anonymous class parameter allows us to detect native classes vs // transpiled classes. - installCustomElements(self, NATIVE_CUSTOM_ELEMENTS_V1 ? class {} : undefined); + installCustomElements(self, class {}); } // TODO(#18268, erwinm): For whatever reason imports to modules that have no diff --git a/src/polyfills/custom-elements.js b/src/polyfills/custom-elements.js index 46b9c82ba391..599b9ac3d314 100644 --- a/src/polyfills/custom-elements.js +++ b/src/polyfills/custom-elements.js @@ -937,9 +937,9 @@ export function copyProperties(obj, prototype) { * done. * * @param {!Window} win - * @param {!Function=} opt_ctor + * @param {!Function} ctor */ -export function install(win, opt_ctor) { +export function install(win, ctor) { // Don't install in no-DOM environments e.g. worker. const shouldInstall = win.document; const hasCE = hasCustomElements(win); @@ -950,7 +950,7 @@ export function install(win, opt_ctor) { let install = true; let installWrapper = false; - if (opt_ctor && hasCE) { + if (ctor && hasCE) { // If ctor is constructable without new, it's a function. That means it was // compiled down, and we need to do the minimal polyfill because all you // cannot extend HTMLElement without native classes. @@ -958,15 +958,16 @@ export function install(win, opt_ctor) { const {Reflect} = win; // "Construct" ctor using ES5 idioms - const instance = /** @type {!Function} */ (Object.create( - opt_ctor.prototype - )); + // I'm not sure why, but Closure will complain at the + // `Function.call.call()` below unless we cast to a Function instance + // here. + const instance = /** @type {!Function} */ (Object.create(ctor.prototype)); // This will throw an error unless we're in a transpiled environemnt. // Native classes must be called as `new Ctor`, not `Ctor.call(instance)`. // We use `Function.call.call` because Closure is too smart for regular // `Ctor.call`. - Function.call.call(opt_ctor, instance); + Function.call.call(ctor, instance); // If that didn't throw, we're transpiled. // Let's find out if we can wrap HTMLElement and avoid a full patch. diff --git a/testing/describes.js b/testing/describes.js index 45cfb27ff3b8..67fd66f206e7 100644 --- a/testing/describes.js +++ b/testing/describes.js @@ -648,10 +648,7 @@ class RealWinFixture { } else { // The anonymous class parameter allows us to detect native classes // vs transpiled classes. - installCustomElements( - win, - NATIVE_CUSTOM_ELEMENTS_V1 ? class {} : undefined - ); + installCustomElements(win, class {}); } // Intercept event listeners diff --git a/testing/iframe.js b/testing/iframe.js index 6e4f5c31b849..5aa6a38173f3 100644 --- a/testing/iframe.js +++ b/testing/iframe.js @@ -245,10 +245,7 @@ export function createIframePromise(opt_runtimeOff, opt_beforeLayoutCallback) { installRuntimeServices(iframe.contentWindow); // The anonymous class parameter allows us to detect native classes vs // transpiled classes. - installCustomElements( - iframe.contentWindow, - NATIVE_CUSTOM_ELEMENTS_V1 ? class {} : undefined - ); + installCustomElements(iframe.contentWindow, class {}); installAmpdocServices(ampdoc); Services.resourcesForDoc(ampdoc).ampInitComplete(); // Act like no other elements were loaded by default.