Skip to content

Commit 275c41a

Browse files
committed
Dirty check in host before setting when using custom events. Fixes #1471.
1 parent 7e77d92 commit 275c41a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/lib/annotations/annotations.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@
262262
_parseNodeAttributeAnnotation: function(node, n, v) {
263263
var escape = this._testEscape(v);
264264
if (escape) {
265+
var customEvent;
265266
// Cache name (`n` will be mangled)
266267
var name = n;
267268
// Mode (one-way or two)
@@ -284,6 +285,7 @@
284285
if (mode == '{' && (colon = v.indexOf('::')) > 0) {
285286
notifyEvent = v.substring(colon + 2);
286287
v = v.substring(0, colon);
288+
customEvent = true;
287289
}
288290
// Remove annotation
289291
node.removeAttribute(n);
@@ -300,7 +302,8 @@
300302
name: name,
301303
value: v,
302304
negate: not,
303-
event: notifyEvent
305+
event: notifyEvent,
306+
customEvent: customEvent
304307
};
305308
}
306309
},

src/lib/bind/effects.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626
this.__data__[effect.value] = value;
2727
}
2828
var calc = effect.negate ? !value : value;
29-
return this._applyEffectValue(calc, effect);
29+
// For better interop, dirty check before setting when custom events
30+
// are used, since the target element may not dirty check (e.g. <input>)
31+
if (!effect.customEvent ||
32+
this._nodes[effect.index][effect.name] !== calc) {
33+
return this._applyEffectValue(calc, effect);
34+
}
3035
},
3136

3237
_reflectEffect: function(source) {

0 commit comments

Comments
 (0)