You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you change the value on the second select element, the first updates, but the subscription does not get notified. The same problem is seen with the CheckedObserver.
In tests, if you add a call to this.notify() in SelectValueObserver.setValue(), it will work, but like i said, i am unsure whether this is intended behavior or not. If it is working as intended, is there a correct way to get the update event instead of using the subscribers?
The text was updated successfully, but these errors were encountered:
All of the observers for DOM elements detect changes by subscribing to DOM events, primarily the change and input events. The DOM fires these events automatically when a user modifies the input. The events do not fire when the input's value is changed programmatically. This means the element observer is unable to detect situations where the value is updated by the binding system, which is what you're seeing.
Here's a plunker that demonstrates that the observed value is accurate only when the element is updated by the user.
<template><label>Select 1:
<selectref="select1"><optionvalue="A">A</option><optionvalue="B">B</option><optionvalue="C">C</option></select></label>
Observed value: <strong>${select1.value}</strong><br/>
<label>Select 2:
<selectref="select2" value.bind="select1.value"><!-- select1 and select2 are bound together --><optionvalue="A">A</option><optionvalue="B">B</option><optionvalue="C">C</option></select></label>
Observed value: <strong>${select2.value}</strong></template>
Maybe we should update the observers to fire DOM events when updating the element. Let me run this by the team and get back to you.
SelectValueObserver and CheckedObserver do not notify all subscribers on change. I am unsure whether this is intended or not, but here is an example:
In the following template
If you change the value on the second select element, the first updates, but the subscription does not get notified. The same problem is seen with the CheckedObserver.
In tests, if you add a call to this.notify() in SelectValueObserver.setValue(), it will work, but like i said, i am unsure whether this is intended behavior or not. If it is working as intended, is there a correct way to get the update event instead of using the subscribers?
The text was updated successfully, but these errors were encountered: