From 9676d6da5968602575409dbb2e05aaa8472ce6ba Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Fri, 24 Jun 2016 18:06:46 -0700 Subject: [PATCH] Make lazyRegister have 'even lazier' behavior such that behaviors are not mixed in until first-instance time. --- src/lib/base.html | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/lib/base.html b/src/lib/base.html index 424a71a1dc..6fe9d0682d 100644 --- a/src/lib/base.html +++ b/src/lib/base.html @@ -30,10 +30,6 @@ // `this` context is a prototype, not an instance registerCallback: function() { - if (!settings.lazierRegister) { - this._desugarBehaviors(); // abstract - this._doBehavior('beforeRegister'); // abstract - } this._registerFeatures(); // abstract if (!settings.lazyRegister) { this.ensureRegisterFinished(); @@ -62,14 +58,12 @@ }, _ensureRegisterFinished: function(proto) { - if (proto.__hasRegisterFinished !== proto.is) { - // TODO(sorvell): moving all behavior work here means that - // custom constructor and is cannot be done in a behavior. - // This probably means we need another flag for this - if (settings.lazierRegister) { - proto._desugarBehaviors(); // abstract - proto._doBehavior('beforeRegister'); // abstract - } + if (proto.__hasRegisterFinished !== proto.is || !proto.is) { + // NOTE: since all behavior is here, this means + // custom constructor and `is` cannot be done in a behavior + // when lazyRegister is true. + proto._desugarBehaviors(); // abstract + proto._doBehavior('beforeRegister'); // abstract proto.__hasRegisterFinished = proto.is; if (proto._finishRegisterFeatures) { proto._finishRegisterFeatures();