[whatwg] UndoManager questions
ajvincent at gmail.com
Sat May 26 20:01:35 PDT 2012
Hi, folks. I'm stubbing out a quick & dirty implementation of UndoManager
For those not familiar, the spec lives here:
* The spec is inconsistent in a few places. For instance, in the green
non-normative section, clearUndo states:
Removes entries in the undo transaction
However, in the normative part, it states:
The clearUndo() method must remove all entries in the undo transaction
Note that one of these states "before", and the other states "after". This
contradiction is not implementable.
* The spec mentions a "DOM transaction
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
** If my transaction throws an exception during .undo(), how should that be
** 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
More information about the whatwg