From e0fbfbe688e00293117dbc8c6a811668d3c1ea1f Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Mon, 2 Nov 2015 17:26:58 -0800 Subject: [PATCH] avoid configuration work when unnecessary --- polymer-micro.html | 2 -- polymer-mini.html | 21 +++++++++--------- polymer.html | 33 ++++++++++++++------------- src/lib/template/templatizer.html | 8 ++++--- src/mini/ready.html | 37 +++++++++++++++++-------------- src/standard/configure.html | 4 +++- 6 files changed, 57 insertions(+), 48 deletions(-) diff --git a/polymer-micro.html b/polymer-micro.html index f443f8658e..3914a91e5b 100644 --- a/polymer-micro.html +++ b/polymer-micro.html @@ -27,8 +27,6 @@ _registerFeatures: function() { // identity this._prepIs(); - // attributes - this._prepAttributes(); // shared behaviors this._prepBehaviors(); // factory diff --git a/polymer-mini.html b/polymer-mini.html index 668fb54502..cfd2b47c98 100644 --- a/polymer-mini.html +++ b/polymer-mini.html @@ -24,8 +24,6 @@ _registerFeatures: function() { // identity this._prepIs(); - // attributes - this._prepAttributes(); // shared behaviors this._prepBehaviors(); // factory @@ -43,14 +41,17 @@ }, _initFeatures: function() { - // manage local dom - this._poolContent(); - // host stack - this._pushHost(); - // instantiate template - this._stampTemplate(); - // host stack - this._popHost(); + this._calcHost(); + if (this._template) { + // manage local dom + this._poolContent(); + // host stack + this._beginHost(); + // instantiate template + this._stampTemplate(); + // host stack + this._popHost(); + } // install host attributes this._marshalHostAttributes(); // setup debouncers diff --git a/polymer.html b/polymer.html index 823d890650..46b62ff91e 100644 --- a/polymer.html +++ b/polymer.html @@ -28,8 +28,6 @@ _registerFeatures: function() { // identity this._prepIs(); - // attributes - this._prepAttributes(); // factory this._prepConstructor(); // template @@ -59,37 +57,42 @@ }, _initFeatures: function() { - // manage local dom - this._poolContent(); // manage configuration this._setupConfigure(); // setup style properties this._setupStyleProperties(); - // host stack - this._pushHost(); - // instantiate template - this._stampTemplate(); - // host stack - this._popHost(); - // concretize template references - this._marshalAnnotationReferences(); // setup debouncers this._setupDebouncers(); + this._calcHost(); + if (this._template) { + // manage local dom + this._poolContent(); + // host stack + this._beginHost(); + // instantiate template + this._stampTemplate(); + // host stack + this._popHost(); + // concretize template references + this._marshalAnnotationReferences(); + } // concretize effects on instance this._marshalInstanceEffects(); // acquire instance behaviors this._marshalBehaviors(); - // install host attributes - this._marshalHostAttributes(); // acquire initial instance attribute values this._marshalAttributes(); + // install host attributes + this._marshalHostAttributes(); // top-down initial distribution, configuration, & ready callback this._tryReady(); }, _marshalBehavior: function(b) { // establish listeners on instance - this._listenListeners(b.listeners); + if (b.listeners) { + this._listenListeners(b.listeners); + } } }); diff --git a/src/lib/template/templatizer.html b/src/lib/template/templatizer.html index dd35ccfa23..b8bf0c7bb7 100644 --- a/src/lib/template/templatizer.html +++ b/src/lib/template/templatizer.html @@ -288,14 +288,15 @@ // Similar to Polymer.Base.extend, but retains any previously set instance // values (_propertySetter back on instance once accessor is installed) _extendTemplate: function(template, proto) { - Object.getOwnPropertyNames(proto).forEach(function(n) { + var n$ = Object.getOwnPropertyNames(proto); + for (var i=0, n; (i