From f278434378076f45f064c31d1c30bb14154de3ad Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Tue, 16 Jul 2019 16:11:27 -0700 Subject: [PATCH] Enable disable-upgrade when `legacyOptimizations` is set to true This matches Polymer 1 behavior. --- lib/legacy/class.js | 3 ++- test/unit/disable-upgrade.html | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/legacy/class.js b/lib/legacy/class.js index 9bfd066bf1..c6d70e536f 100644 --- a/lib/legacy/class.js +++ b/lib/legacy/class.js @@ -241,7 +241,8 @@ function GenerateClassFromInfo(info, Base, behaviors) { // Prevent element from initializing properties when it's upgrade disabled. /** @override */ _initializeProperties() { - if (!this.hasAttribute(DISABLED_ATTR)) { + // Enable disable-upgrade use when `legacyOptimizations` setting is on. + if (legacyOptimizations && !this.hasAttribute(DISABLED_ATTR)) { super._initializeProperties(); } else { this.__isUpgradeDisabled = true; diff --git a/test/unit/disable-upgrade.html b/test/unit/disable-upgrade.html index bf430f648f..47bca562ad 100644 --- a/test/unit/disable-upgrade.html +++ b/test/unit/disable-upgrade.html @@ -77,6 +77,10 @@

[[prop]]

import { DisableUpgradeMixin } from '../../lib/mixins/disable-upgrade-mixin.js'; import { Class as PolymerClass } from '../../lib/legacy/class.js'; import { Polymer } from '../../lib/legacy/polymer-fn.js'; +import {setLegacyOptimizations} from '../../lib/utils/settings.js'; + +// This setting is for all tests... +setLegacyOptimizations(true); Polymer({ is: 'x-disabled-legacy',