Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make event notification handler read the value from currentTarget, #5309

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mixins/property-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
toPath = Polymer.Path.translate(fromProp, toPath, fromPath);
value = detail && detail.value;
} else {
value = event.target[fromProp];
value = event.currentTarget[fromProp];
}
value = negate ? !value : value;
if (!inst[TYPES.READ_ONLY] || !inst[TYPES.READ_ONLY][toPath]) {
Expand Down
10 changes: 10 additions & 0 deletions test/unit/property-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@
assert.equal(el.observerCounts.customEventValueChanged, 1, 'custom bound property observer not called');
});

test('custom notification bubbling event to property', function() {
const child = document.createElement('div');
el.$.boundChild.appendChild(child);

el.$.boundChild.customEventValue = 42;
child.dispatchEvent(new Event('custom', {bubbles: true}));
assert.equal(el.customEventValue, 42, 'custom bound property incorrect');
assert.equal(el.observerCounts.customEventValueChanged, 1, 'custom bound property observer not called');
});

test('custom notification event to path', function() {
el.clearObserverCounts();
el.$.boundChild.customEventObjectValue = 84;
Expand Down