diff --git a/lib/legacy/class.html b/lib/legacy/class.html
index 99fa627085..4ecd9d331e 100644
--- a/lib/legacy/class.html
+++ b/lib/legacy/class.html
@@ -205,12 +205,8 @@
are controlled via the finalization mechanism provided by `Properties-Mixin`.
`Properties` and `observers` are collected by manually traversing the prototype
- chain and merging.
-
- The `_registered` method is called via `LegacyElementMixin._finalizeClass`
- and is called on each prototype in the element's chain. Because a non-legacy
- element may extend a legacy one, it's important that work in `_registered`
- carefully act only once.
+ chain and merging. The `_registered` method is called via
+ `LegacyElementMixin._finalizeClass`.
*/
/**
@@ -224,7 +220,6 @@
function GenerateClassFromInfo(info, Base, behaviors) {
// manages behavior and lifecycle processing (filled in after class definition)
- let registered = false;
let activeBehaviors;
const lifecycle = {};
@@ -285,27 +280,20 @@
`is` in `beforeRegister` as you could in 1.x.
*/
const proto = this;
- // NOTE: this `registered` flag is required so that extensions
- // that do not override `_registered` do not try to "re-register"
- // this data. Only extensions that use `mixinBehaviors` will normally
- // have this implementation.
- if (!registered) {
- registered = true;
- if (activeBehaviors) {
- copyAndFilterBehaviors(proto, activeBehaviors, lifecycle);
- }
- copyAndFilterProperties(proto, info, lifecycle);
- let list = lifecycle.beforeRegister;
- if (list) {
- for (let i=0; i < list.length; i++) {
- list[i].call(proto);
- }
+ if (activeBehaviors) {
+ copyAndFilterBehaviors(proto, activeBehaviors, lifecycle);
+ }
+ copyAndFilterProperties(proto, info, lifecycle);
+ let list = lifecycle.beforeRegister;
+ if (list) {
+ for (let i=0; i < list.length; i++) {
+ list[i].call(proto);
}
- list = lifecycle.registered;
- if (list) {
- for (let i=0; i < list.length; i++) {
- list[i].call(proto);
- }
+ }
+ list = lifecycle.registered;
+ if (list) {
+ for (let i=0; i < list.length; i++) {
+ list[i].call(proto);
}
}
}
diff --git a/lib/legacy/legacy-element-mixin.html b/lib/legacy/legacy-element-mixin.html
index 59514e4993..fa0149d4a7 100644
--- a/lib/legacy/legacy-element-mixin.html
+++ b/lib/legacy/legacy-element-mixin.html
@@ -95,7 +95,12 @@
}
static _finalizeClass() {
- this.prototype._registered();
+ // Note, call `_registered` only if this specific prototype has
+ // an implementation; this ensures `_registered` is not called
+ // on extenders that do not implement it.
+ if (this.prototype.hasOwnProperty('_registered')) {
+ this.prototype._registered();
+ }
super._finalizeClass();
}