Skip to content

Commit ffe8f7e

Browse files
tomalecTimvdLippe
authored andcommitted
Make event notification handler read the value from currentTarget, (#5309)
instead of target which may not be bound to any data. Fixes #5308
1 parent d59546d commit ffe8f7e

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

lib/mixins/property-effects.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
toPath = Polymer.Path.translate(fromProp, toPath, fromPath);
357357
value = detail && detail.value;
358358
} else {
359-
value = event.target[fromProp];
359+
value = event.currentTarget[fromProp];
360360
}
361361
value = negate ? !value : value;
362362
if (!inst[TYPES.READ_ONLY] || !inst[TYPES.READ_ONLY][toPath]) {

test/unit/property-effects.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,16 @@
329329
assert.equal(el.observerCounts.customEventValueChanged, 1, 'custom bound property observer not called');
330330
});
331331

332+
test('custom notification bubbling event to property', function() {
333+
const child = document.createElement('div');
334+
el.$.boundChild.appendChild(child);
335+
336+
el.$.boundChild.customEventValue = 42;
337+
child.dispatchEvent(new Event('custom', {bubbles: true}));
338+
assert.equal(el.customEventValue, 42, 'custom bound property incorrect');
339+
assert.equal(el.observerCounts.customEventValueChanged, 1, 'custom bound property observer not called');
340+
});
341+
332342
test('custom notification event to path', function() {
333343
el.clearObserverCounts();
334344
el.$.boundChild.customEventObjectValue = 84;

0 commit comments

Comments
 (0)