On 11-08-05 1:01 PM, Ryosuke Niwa wrote:
On Fri, Aug 5, 2011 at 9:57 AM, Jonas Sicking<jo...@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