[whatwg] Undo Manager specs is confusing in the contenteditable section

Ryosuke Niwa rniwa at webkit.org
Wed Jul 4 15:20:52 PDT 2012


On Wed, Jun 20, 2012 at 12:21 PM, Caio Marcelo de Oliveira Filho <
caio.oliveira at openbossa.org> wrote:
>
>  > *2.2.1 Undo scope and contenteditable*
> > *
> > *When the contenteditable content attribute is added to an element, the
> > user agent must remove all entries in the undo transaction histories
> > of the editable
> > undo scope hosts that are descendent of the element and have become
> > editable without unapplying or reapplying the entries and disconnect the
> > corresponding UndoManagers as if the undoscope content attribute was
> > removed from all descendent nodes excluding undo scope hosts and their
> > descendents.*
> >
> > What does "editable undo hosts" imply here?
>
> From my understanding they are the elements that were undo hosts but
> now, because the addition of contenteditable content attribute, became
> editable elements, so not undo hosts anymore.
>

I agree the wording here was confusing. Revised it to clarify:
http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html#undo-scope-and-contenteditable

> Also when contenteditable is added to an element all
> > the descendant elements become editable, so none of the descendants
> should
> > be a undo scope host as "undoscope content attribute on an editable
> element
> > is ignored". So is "*excluding undo scope hosts and their descendents*"
> > valid?
>
> We can have non-editable elements that are descendents of an element
> with contenteditable=true. For example:
>
> <div id="container">
>   <div id="A" undoscope>This will be editable</div>
>   <div id="B" contenteditable=false undoscope>This will remain not
> editable</div>
> </div>
>
> When div "container" gets contenteditable=true, the div "A" will have
> its undoManager disconnected, but not the div "B", because its not
> editable. Would a non-normative box with an example like this one be
> helpful in the spec?
>

Thanks for the example! Added it to 2.2.1.

Maybe we could change the second paragraph of 2.2.1 to make things clearer:
>
> ----8<---
> When the contenteditable content attribute is added to an element, the
> user agent must remove all entries in the undo transaction histories
> of the descendents of the element that were undo scope hosts but have
> become editable without unapplying or reapplying the entries and
> disconnect the corresponding UndoManagers as if the undoscope content
> attribute was removed from the now editable descendent nodes.
> --->8---
>

I think the first part about removing entires is redundant since
disconnected undo manger will throw errors on all attempts to modify the
UndoManager. If anything, we can remove all entries in the definition of
"disconnect" instead of the section 2.2.1

- Ryosuke


More information about the whatwg mailing list