mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Avoid stomping on property objects when mixing behaviors.
This commit is contained in:
parent
dc2255c8b3
commit
ec4d3132cd
@ -42,12 +42,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
this._prepEffects();
|
this._prepEffects();
|
||||||
// shared behaviors
|
// shared behaviors
|
||||||
this._prepBehaviors();
|
this._prepBehaviors();
|
||||||
|
// fast access to property info
|
||||||
|
this._prepPropertyInfo();
|
||||||
// accessors part 2
|
// accessors part 2
|
||||||
this._prepBindings();
|
this._prepBindings();
|
||||||
// dom encapsulation
|
// dom encapsulation
|
||||||
this._prepShady();
|
this._prepShady();
|
||||||
// fast access to property info
|
|
||||||
this._prepPropertyInfo();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_prepBehavior: function(b) {
|
_prepBehavior: function(b) {
|
||||||
|
@ -170,6 +170,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
// ReadOnly properties have a private setter only
|
// ReadOnly properties have a private setter only
|
||||||
// TODO(kschaaf): Per current Bind factoring, we shouldn't
|
// TODO(kschaaf): Per current Bind factoring, we shouldn't
|
||||||
// be interrogating the prototype here
|
// be interrogating the prototype here
|
||||||
|
// TODO(sorvell): we want to avoid using `getPropertyInfo` here, but
|
||||||
|
// this requires more data in `_propertyInfo`
|
||||||
var info = model.getPropertyInfo && model.getPropertyInfo(property);
|
var info = model.getPropertyInfo && model.getPropertyInfo(property);
|
||||||
if (info && info.readOnly) {
|
if (info && info.readOnly) {
|
||||||
// Computed properties are read-only (no property setter), but also don't
|
// Computed properties are read-only (no property setter), but also don't
|
||||||
|
@ -116,8 +116,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
archetype._prepEffects();
|
archetype._prepEffects();
|
||||||
this._customPrepEffects(archetype);
|
this._customPrepEffects(archetype);
|
||||||
archetype._prepBehaviors();
|
archetype._prepBehaviors();
|
||||||
archetype._prepBindings();
|
|
||||||
archetype._prepPropertyInfo();
|
archetype._prepPropertyInfo();
|
||||||
|
archetype._prepBindings();
|
||||||
|
|
||||||
// boilerplate code
|
// boilerplate code
|
||||||
archetype._notifyPathUp = this._notifyPathUpImpl;
|
archetype._notifyPathUp = this._notifyPathUpImpl;
|
||||||
|
@ -105,6 +105,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
* @param {string} property Name of property to introspect.
|
* @param {string} property Name of property to introspect.
|
||||||
* @return {Object} Property descriptor for specified property.
|
* @return {Object} Property descriptor for specified property.
|
||||||
*/
|
*/
|
||||||
|
// TODO(sorvell): This function returns the first property object found
|
||||||
|
// and this is not the property info Polymer acts on for readOnly or type
|
||||||
|
// This api should be combined with _propertyInfo.
|
||||||
getPropertyInfo: function(property) {
|
getPropertyInfo: function(property) {
|
||||||
var info = this._getPropertyInfo(property, this.properties);
|
var info = this._getPropertyInfo(property, this.properties);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@ -156,8 +159,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!target[i]) {
|
if (!target[i]) {
|
||||||
target[i] = t = typeof(s) === 'function' ? {type: s} : s;
|
target[i] = {
|
||||||
t.attribute = Polymer.CaseMap.camelToDashCase(i);
|
type: typeof(s) === 'function' ? s : s.type,
|
||||||
|
readOnly: s.readOnly,
|
||||||
|
attribute: Polymer.CaseMap.camelToDashCase(i)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!t.type) {
|
if (!t.type) {
|
||||||
t.type = s.type;
|
t.type = s.type;
|
||||||
@ -165,12 +171,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
if (!t.readOnly) {
|
if (!t.readOnly) {
|
||||||
t.readOnly = s.readOnly;
|
t.readOnly = s.readOnly;
|
||||||
}
|
}
|
||||||
if (!t.notify) {
|
|
||||||
t.notify = s.notify;
|
|
||||||
}
|
|
||||||
if (!t.readOnly) {
|
|
||||||
t.readOnly = s.readOnly;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user