diff --git a/src/instance/properties.js b/src/instance/properties.js index 4223d813ba..d5a19f4d8c 100644 --- a/src/instance/properties.js +++ b/src/instance/properties.js @@ -19,6 +19,7 @@ var properties = { // set up property observers + /* observeProperties: function() { // TODO(sjmiles): // we observe published properties so we can reflect them to attributes @@ -48,6 +49,7 @@ } } }, + */ _observe: function(name, cb) { log.observe && console.log(LOG_OBSERVE, this.localName, name); registerObserver(this, name, @@ -81,7 +83,49 @@ }, unbindAllProperties: function() { unregisterObservers(this); - } + if (this._propertyObserver) { + this._propertyObserver.close(); + } + }, + + observeProperties: function() { + var n$ = this._observeNames, pn$ = this._publishNames; + if ((n$ && n$.length) || (pn$ && pn$.length)) { + var self = this; + var o = this._propertyObserver = new CompoundPathObserver(function( + newValues, oldValues, changedBits) { + self.notifyPropertyChanges(newValues, oldValues, changedBits); + }, this, undefined, undefined); + var p = this._propertyObserverNames = []; + for (var i=0, l=n$.length, n; (i