Skip to content

Commit

Permalink
Enable disable-upgrade when legacyOptimizations is set to true
Browse files Browse the repository at this point in the history
This matches Polymer 1 behavior.
  • Loading branch information
Steven Orvell committed Jul 16, 2019
1 parent 42f00cd commit f278434
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/legacy/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions test/unit/disable-upgrade.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ <h2 id="element">[[prop]]</h2>
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',
Expand Down

0 comments on commit f278434

Please sign in to comment.