From dcefa708c94707a83c820601569617f8418b5a3f Mon Sep 17 00:00:00 2001 From: Scott Miles Date: Mon, 5 Nov 2012 12:52:20 -0800 Subject: [PATCH 1/3] in takeAttributes, trap attributes containing mustache markup and treat them as uninitialized --- src/g-component.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/g-component.html b/src/g-component.html index 6744258673..1407266c8a 100644 --- a/src/g-component.html +++ b/src/g-component.html @@ -296,17 +296,29 @@ 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); From 98cce180cf0ffe4afd1a90caceeefab6375ea1a6 Mon Sep 17 00:00:00 2001 From: Scott Miles Date: Mon, 5 Nov 2012 18:34:50 -0800 Subject: [PATCH 2/3] s/inUber/inLifecycle, other non-semantic changes; add optional 3rd parameter for timeout duration to asyncMethod --- src/g-component.html | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/g-component.html b/src/g-component.html index 1407266c8a..67e937f111 100644 --- a/src/g-component.html +++ b/src/g-component.html @@ -72,7 +72,7 @@ // event bindings // - // Date: Mon, 5 Nov 2012 18:40:17 -0800 Subject: [PATCH 3/3] make asyncMethod return the setTimeout handle --- src/g-component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g-component.html b/src/g-component.html index acae8ef77e..99dd0a462b 100644 --- a/src/g-component.html +++ b/src/g-component.html @@ -379,7 +379,7 @@ // asyncMethod impl var asyncMethod = function(inMethod, inArgs, inTimeout) { - window.setTimeout(function() { + return window.setTimeout(function() { this[inMethod].apply(this, inArgs); }.bind(this), inTimeout || 0); };