[whatwg] Feedback on UndoManager spec
jonas at sicking.cc
Wed Oct 26 23:06:42 PDT 2011
On Wed, Oct 26, 2011 at 9:06 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On Wed, Oct 26, 2011 at 8:21 PM, Jonas Sicking <jonas at sicking.cc> wrote:
>> Why is it problematic to move an element with an undoManager from one
>> document to another. If all the data that the undomanager needs lives
>> inside the undoManager object itself, it seems quite possible to move
>> between documents or even interact with while not inside a document.
> The problem is that if the undo manager has automatic transactions in them,
> then they'll have references to nodes to undo/redo transactions. But those
> nodes's owner document is still that of the old document. At least in
> WebKit, this will be a bit of an issue.
The way that the DOM4 spec is written these days, those nodes will get
automatically adopted when they are inserted into the new document.
If webkit has limitations around that, those limitations needs to be
fixed anyway in order to implement DOM4 correctly.
>> Note that the upcoming mutation observer spec makes no difference
>> between nodes in a document and nodes which are not. So if the
>> undoManager uses the same backend, or is even built on top of it, then
>> things will just automatically work.
> I thought about implementing UndoManager on top of new DOM mutation observer
> API, but the asynchronous nature of new notification API makes it a little
> hard, if not impossible, to implement UndoManager's synchronous API
In Gecko we're implementing both specs on the same synchronous backend.
You're right that implementing on top of the notification API is
likely going to be hard.
More information about the whatwg