in takeAttributes, trap attributes containing mustache markup and treat them as uninitialized

This commit is contained in:
Scott Miles
2012-11-05 12:52:20 -08:00
parent 1ce994cd33
commit dcefa708c9

View File

@@ -296,17 +296,29 @@ license that can be found in the LICENSE file.
squelchSideEffects = true;
this.boundAttributes.forEach(function(a) {
if (this.hasAttribute(a)) {
var value = deserializeValue(this.getAttribute(a));
// get raw attribute value
var value = this.getAttribute(a);
// filter out 'mustached' values, these are to be
// replaced with bound-data and are not runtime
// values themselves
if (value.indexOf(bindModel.mustache) >= 0) {
return;
}
// deserialize Boolean or Number values from attribute
value = deserializeValue(value);
if (this[a] !== value) {
// track values that differ from property values
changed.push({name: a, old: this[a]});
// install new value (side-effects squelched)
this[a] = value;
}
this[a] = deserializeValue(value);
}
}, this);
} finally {
squelchSideEffects = false;
}
// invoke side-effects in a batch after initializing
// all values
changed.forEach(function(c) {
propertyChanged.call(this, c.name, c.old);
}, this);