Re: Mutation events replacement

On 04/07/11 17:57, Olli Pettay wrote:
> Mutation listener could easily
> implement old/new value handling itself, especially if it knows which
> attributes it is interested in.

How exactly would the listener know the previous state?

For a concurrent editing app, it is important to be able to describe 
changes reversibly so that you can revert the DOM when a given local 
edit isn't accepted, or you need to revert before applying accepted 
changes from other clients. I have been able to get this to work fine 
with the existing mutation events. Of course, I avoid changing the DOM 
within a mutation event listener, but it is easy to defer such changes 
by a call to setTimeout, e.g. with a time of zero. I would be quite 
happy for the browser to throw an exception when a mutation event 
listener tries to call an unsafe API, as this way developers would 
rapidly learn of their mistake and switch to better practices.

-- 
  Dave Raggett<dsr@w3.org>  http://www.w3.org/People/Raggett

Received on Monday, 4 July 2011 18:02:16 UTC