W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2011

[whatwg] Fixing undo on the Web - UndoManager and Transaction

From: Ehsan Akhgari <ehsan@mozilla.com>
Date: Thu, 11 Aug 2011 17:53:34 -0400
Message-ID: <4E444F5E.3050405@mozilla.com>
On 11-08-05 1:01 PM, Ryosuke Niwa wrote:
> On Fri, Aug 5, 2011 at 9:57 AM, Jonas Sicking<jonas at sicking.cc>  wrote:
>
>> Why treat documentElement specially here? Just make the documentElement
>> *not* have a undoManager by default and have it just use it's ancestor's,
>> just like all other elements.
>>
>> The document is an ancestor of the documentElement after all.
>>
> Anne had a different idea to make documentElement have the root undoManager
> to avoid adding a new property to Document.  I personally like your approach
> but I don't know enough about Web IDLs to give a call.
>
> Anyone else have opinions on this?

I think the confusion is arising because you chose to attach undoManager 
to elements, not nodes.  Note that document _is_ a node in the DOM, but 
it's not an element.  I think we should just modify the spec to attach 
undoManager to nodes.  Once we have that, we don't need to treat 
documentElement specially at all, it just looks at its parent (the 
document node) and gets the undoManager from there.

The only downside is that we should explicitly prohibit some node types 
from having an undoManager where it doesn't make sense (such as text 
nodes, comment nodes, etc.).  We can enumerate them explicitly and say 
that accessing the undoManager on these types of nodes will throw.

Does that make sense?

Ehsan
Received on Thursday, 11 August 2011 14:53:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:08 UTC