Skip to content

Commit

Permalink
Dirty check in host before setting when using custom events. Fixes #1471
Browse files Browse the repository at this point in the history
.
  • Loading branch information
kevinpschaaf committed May 6, 2015
1 parent 7e77d92 commit 275c41a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/lib/annotations/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
_parseNodeAttributeAnnotation: function(node, n, v) {
var escape = this._testEscape(v);
if (escape) {
var customEvent;
// Cache name (`n` will be mangled)
var name = n;
// Mode (one-way or two)
Expand All @@ -284,6 +285,7 @@
if (mode == '{' && (colon = v.indexOf('::')) > 0) {
notifyEvent = v.substring(colon + 2);
v = v.substring(0, colon);
customEvent = true;
}
// Remove annotation
node.removeAttribute(n);
Expand All @@ -300,7 +302,8 @@
name: name,
value: v,
negate: not,
event: notifyEvent
event: notifyEvent,
customEvent: customEvent
};
}
},
Expand Down
7 changes: 6 additions & 1 deletion src/lib/bind/effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
this.__data__[effect.value] = value;
}
var calc = effect.negate ? !value : value;
return this._applyEffectValue(calc, effect);
// For better interop, dirty check before setting when custom events
// are used, since the target element may not dirty check (e.g. <input>)
if (!effect.customEvent ||
this._nodes[effect.index][effect.name] !== calc) {
return this._applyEffectValue(calc, effect);
}
},

_reflectEffect: function(source) {
Expand Down

0 comments on commit 275c41a

Please sign in to comment.