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

Ehsan Akhgari ehsan at mozilla.com
Fri Aug 12 14:38:31 PDT 2011


On 11-08-11 6:07 PM, Jonas Sicking wrote:
> On Thu, Aug 11, 2011 at 2:56 PM, Ryosuke Niwa<rniwa at webkit.org>  wrote:
>> On Thu, Aug 11, 2011 at 2:53 PM, Ehsan Akhgari<ehsan at mozilla.com>  wrote:
>>>
>>> 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.
>>
>> Makes sense.
>>>
>>> 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.
>>
>> Alternatively, can we say that only Element and Document are allowed to have
>> it?
>
> Yup, that's what I think we should do. Though it'll sort of fall out
> naturally since UndoManagers are by default only available on
> Documents, and the only way you can enable it on other Nodes is
> through attributes, which only exist on Elements.

Yes, that sounds good to me too.

Ehsan



More information about the whatwg mailing list