diff --git a/src/micro/behaviors.html b/src/micro/behaviors.html index 1db6d40fee..f0e55800ec 100644 --- a/src/micro/behaviors.html +++ b/src/micro/behaviors.html @@ -60,10 +60,23 @@ _desugarBehaviors: function() { if (this.behaviors.length) { - this.behaviors = this._flattenBehaviorsList(this.behaviors); + this.behaviors = this._desugarSomeBehaviors(this.behaviors); } }, + _desugarSomeBehaviors: function(behaviors) { + // iteration 1 + behaviors = this._flattenBehaviorsList(behaviors); + // iteration 2 + // traverse the behaviors in _reverse_ order (youngest first) because + // `_mixinBehavior` has _first property wins_ behavior, this is done + // to optimize # of calls to `_copyOwnProperty` + for (var i=behaviors.length-1; i>=0; i--) { + this._mixinBehavior(behaviors[i]); + } + return behaviors; + }, + _flattenBehaviorsList: function(behaviors) { var flat = []; behaviors.forEach(function(b) { @@ -80,28 +93,8 @@ return flat; }, - _prepBehaviors: function() { - this._prepFlattenedBehaviors(this.behaviors); - }, - - _prepFlattenedBehaviors: function(behaviors) { - // traverse the behaviors in _reverse_ order (youngest first) because - // `_mixinBehavior` has _first property wins_ behavior, this is done - // to optimize # of calls to `_copyOwnProperty` - for (var i=behaviors.length-1; i>=0; i--) { - this._mixinBehavior(behaviors[i]); - } - // we iterate a second time so that `_prepBehavior` goes in natural order - // otherwise, it's a tricky detail for implementors of `_prepBehavior` - for (var i=0, l=behaviors.length; i