diff --git a/lib/legacy/class.html b/lib/legacy/class.html index 2856cd773e..108e3d1f4f 100644 --- a/lib/legacy/class.html +++ b/lib/legacy/class.html @@ -131,8 +131,6 @@ function GenerateClassFromInfo(info, Base) { - let registered = false; - class PolymerGenerated extends Base { static get properties() { @@ -163,13 +161,9 @@ } _registered() { - if (!registered) { - super._registered(); - // call `registered` only if it was not called for *this* constructor - registered = true; - if (info.registered) { - info.registered.call(Object.getPrototypeOf(this)); - } + super._registered(); + if (info.registered) { + info.registered.call(Object.getPrototypeOf(this)); } } diff --git a/lib/legacy/legacy-element-mixin.html b/lib/legacy/legacy-element-mixin.html index 6272b1cecf..8f67b81ee2 100644 --- a/lib/legacy/legacy-element-mixin.html +++ b/lib/legacy/legacy-element-mixin.html @@ -105,12 +105,17 @@ /** * Overrides the default `Polymer.PropertyEffects` implementation to - * add support for one-time `registration` callback. + * add support for class initialization via the `_registered` callback. + * This is called only when the first instance of the element is created. * * @override */ _initializeProperties() { - this._registered(); + let proto = Object.getPrototypeOf(this); + if (!proto.hasOwnProperty('__hasRegisterFinished')) { + proto.__hasRegisterFinished = true; + this._registered(); + } super._initializeProperties(); } diff --git a/test/unit/mixin-behaviors.html b/test/unit/mixin-behaviors.html index e64ee2ae24..8bfd9dbfe1 100644 --- a/test/unit/mixin-behaviors.html +++ b/test/unit/mixin-behaviors.html @@ -329,12 +329,18 @@ BehaviorRegistered.prototype.registeredCount = 0; customElements.define(BehaviorRegistered.is, BehaviorRegistered); + + class BehaviorRegisteredExt extends BehaviorRegistered { + static get is() { return 'behavior-registered-ext'} + } + + BehaviorRegisteredExt.prototype.registeredCount = 0; + + customElements.define(BehaviorRegisteredExt.is, BehaviorRegisteredExt); }); - - + + + +