[whatwg] UndoManager questions

Hi, folks.  I'm stubbing out a quick & dirty implementation of UndoManager
in JavaScript, and I have a few questions.

For those not familiar, the spec lives here:
http://rniwa.com/editing/undomanager.html

* The spec is inconsistent in a few places.  For instance, in the green
non-normative section, clearUndo states:
Removes entries in the undo transaction
history<http://rniwa.com/editing/undomanager.html#undo-transaction-history>before
position<http://rniwa.com/editing/undomanager.html#dom-undomanager-position>and
resets
position<http://rniwa.com/editing/undomanager.html#dom-undomanager-position>to
0.

However, in the normative part, it states:
The clearUndo() method must remove all entries in the undo transaction
history <http://rniwa.com/editing/undomanager.html#undo-transaction-history>after
the undo
position <http://rniwa.com/editing/undomanager.html#undo-position>.

Note that one of these states "before", and the other states "after".  This
contradiction is not implementable.

* The spec mentions a "DOM transaction
group<http://rniwa.com/editing/undomanager.html#dom-transaction-group>",
but does not define that.

* When adding a transaction to a DOMTransaction[] as part of execute's
merge being true, do we add it to the beginning or the end of the list?
This matters for .item().

* Exception handling is woefully undefined in this spec:
** If my transaction throws an exception during UndoManager.execute(), how
should that be handled? What happens to transaction groups that were
previously undone?
** If my transaction throws an exception during .undo(), how should that be
handled?
** Ditto redo.

* What precisely lives at UndoManager.item(0)?  The most recently completed
transaction, or the oldest?

* When UndoManager.execute() is called with an object not implementing
.undo, or .redo, should we fire some kind of warning to the user?  What
should happen when we try to undo that transaction?

Given all the above, I think I need to write some tests for UndoManager.
Anyone mind Jasmine-based tests?

-- 
"The first step in confirming there is a bug in someone else's work is
confirming there are no bugs in your own."
-- Alexander J. Vincent, June 30, 2001

Received on Sunday, 27 May 2012 03:02:06 UTC