From 2d9e07ec2b64ea2fcedbc6ff51e8c590d7f7a2cd Mon Sep 17 00:00:00 2001 From: John Messerly Date: Thu, 28 Aug 2014 15:38:21 -0700 Subject: [PATCH] allow computed properties to be bindable, fixes https://github.com/Polymer/polymer/issues/638 --- src/declaration/properties.js | 18 ++++++++---- src/instance/properties.js | 31 +++++++++++++++++--- test/html/computedProperties.html | 47 ++++++++++++++++++++++--------- 3 files changed, 73 insertions(+), 23 deletions(-) diff --git a/src/declaration/properties.js b/src/declaration/properties.js index 656d9b4..dbd77ff 100644 --- a/src/declaration/properties.js +++ b/src/declaration/properties.js @@ -129,7 +129,7 @@ } return map; }, - createPropertyAccessor: function(name) { + createPropertyAccessor: function(name, ignoreWrites) { var proto = this.prototype; var privateName = name + '_'; @@ -145,6 +145,10 @@ return this[privateName]; }, set: function(value) { + if (ignoreWrites) { + return this[privateName]; + } + var observable = this[privateObservable]; if (observable) { observable.setValue(value); @@ -161,16 +165,20 @@ }); }, createPropertyAccessors: function(prototype) { - var n$ = prototype._publishNames; + var n$ = prototype._computedNames; if (n$ && n$.length) { for (var i=0, l=n$.length, n, fn; (i - - - - + + + + + + + + +