Permalink
Browse files

asynctypes-685526: fix sync promise breakage

If we had a promise on an attribute that turned out to be already
resolved then previously we cleared the value after we set it. Now we
don't.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
  • Loading branch information...
1 parent 3fd796b commit 6317fed18e852bc71cfe6e75828f347a5bcbae7a @joewalker joewalker committed Mar 11, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/util/domtemplate.js
View
@@ -177,21 +177,21 @@ Templater.prototype.processNode = function(node, data) {
if (value.indexOf('${') === 0 && value.charAt(value.length - 1) === '}') {
replacement = this._envEval(value.slice(2, -1), data, value);
if (replacement && typeof replacement.then === 'function') {
+ node.setAttribute(name, '');
replacement.then(function(newValue) {
node.setAttribute(name, newValue);
}.bind(this)).then(null, console.error);
- replacement = '';
}
else {
if (this.options.blankNullUndefined && replacement == null) {
replacement = '';
}
+ node.setAttribute(name, replacement);
}
}
else {
- replacement = this._processString(value, data);
+ node.setAttribute(name, this._processString(value, data));
}
- node.setAttribute(name, replacement);
}
}
finally {

1 comment on commit 6317fed

Member

r+

Please sign in to comment.