[whatwg] Feedback on UndoManager spec
jonas at sicking.cc
Wed Oct 26 20:26:18 PDT 2011
On Wed, Oct 26, 2011 at 11:39 AM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On Wed, Oct 26, 2011 at 10:57 AM, Aryeh Gregor <ayg at aryeh.name> wrote:
>> >> 2) What happens if you have an Element with the undoscope attribute
>> >> that doesn't descend from a Document? Does undo management make any
>> >> sense in that case, or should the undoscope attribute have no effect
>> >> for detached elements?
>> > This is a debatable point. On one hand, allowing a node with undoManager
>> > to
>> > be moved to another location in DOM seems nice but on the other hand,
>> > being
>> > able to move a node with undoManager to a different document will be
>> > problematic. And semantically, moving undoManager makes very little
>> > sense.
>> Well, if you do
>> var span = document.createElement("span");
>> span.undoScope = true;
>> what is the value of span.undoManager? Per the current spec, it
>> should return an UndoManager that works just fine. Is this desired,
>> or do you want to return null in this case?
> I'm not sure if we should allow that or not. I'm inclined towards not
> allowing it for the sake of disallowing undoManager on a detached node.
I don't see why the undoManager implementation would need to care why
the element it's attached to is in the document tree or not all. All
it needs to do is to observe modifications to the descendants of the
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 think there is a lot of value in allowing a element to be moved
around in a document. Even when that element, or a descendant of it,
has a undoManager attached.
More information about the whatwg