Skip to content

Commit f7d86e9

Browse files
author
Steven Orvell
committed
Improve efficiency of attribute configuration.
1 parent 25aab8b commit f7d86e9

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎polymer.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@
7777
this._setupDebouncers();
7878
// concretize effects on instance
7979
this._marshalInstanceEffects();
80-
// install host attributes
81-
this._marshalHostAttributes();
8280
// acquire instance behaviors
8381
this._marshalBehaviors();
82+
// install host attributes
83+
this._marshalHostAttributes();
8484
// acquire initial instance attribute values
8585
this._marshalAttributes();
8686
// top-down initial distribution, configuration, & ready callback

‎src/micro/attributes.html‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@
8181
// since shimming classes would make it work
8282
// inconsisently under native SD
8383
if (!this.hasAttribute(n) && (n !== 'class')) {
84-
this.serializeValueToAttribute(attr$[n], n, this);
84+
var v = attr$[n];
85+
this.serializeValueToAttribute(v, n, this);
86+
// if necessary, add this value to configuration...
87+
if (!this._clientsReady && this._propertyInfo[n] &&
88+
(this._config[n] === undefined)) {
89+
this._config[n] = v;
90+
}
8591
}
8692
}
8793
},
@@ -91,10 +97,12 @@
9197
},
9298

9399
_takeAttributesToModel: function(model) {
94-
for (var i in this._propertyInfo) {
95-
var info = this._propertyInfo[i];
96-
if (this.hasAttribute(info.attribute)) {
97-
this._setAttributeToProperty(model, info.attribute, i, info);
100+
if (this.hasAttributes()) {
101+
for (var i in this._propertyInfo) {
102+
var info = this._propertyInfo[i];
103+
if (this.hasAttribute(info.attribute)) {
104+
this._setAttributeToProperty(model, info.attribute, i, info);
105+
}
98106
}
99107
}
100108
},

0 commit comments

Comments
 (0)