On 2010-03-11, at 01:52, jamesr wrote: > On Thu, 11 Mar 2010 01:37:43 -0500, <[email protected]> wrote: > >> Is it considered correct behavior, when an attribute is 'updated' with same >> value, that the "on changed" event is not generated? >> > > This is a very interesting topic. depends on who you ask. Here, i believe it > emphatically "yes", but this is not a bug - it's a consequence of design > decisions.
[I know James disagrees with this design decision, but...] It is not a bug. It is an explicit design decision in the implementation of constraints for both efficiency and to ensure that constraints will "resolve". If an event were always sent for an unchanged value, complex constraints might never settle. It is important to distinguish between the implicit event associated with every attribute (for each attribute `x`, there is an implicit attribute `onx`) which is automatically set each time the attribute is _changed_, and explicit events (e.g., `ondata`, `onerror`, and `ontimeout` sent when a node has a databinding). Explicit events, sent by `sendEvent`, will always be sent. Implicit events are only _required_ to be sent when a value is changed, by `setAttribute` The requirement that an event be sent when a value is changed by `setAttribute` does not prohibit sending an event when the attribute value is unchanged, but it does not require it; hence you cannot rely on that. Put another way: sometimes you may get an event for an update that does not change the value, but you cannot rely on that. > however in your case - it's thankfully a much easier fix. Browser caching can > cause this! try using the getTime() method to make a throwaway query string > argument so that your url looks like > > http://something.com/picture.jpg?throwaway=789324934 > > so that the throwaway argument changes every request and you will be able to > reload your image. Am i close? This is a very important point (thank you James): even if an event were sent each time, the browser (or any intermediate caching proxy) may not realize that the image associated with the URL has changed, since you are fetching the same URL. You would need to use a technique like James proposes to ensure that your image is actually re-fetched from the source server each time.
