W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2012

[whatwg] UndoManager questions

From: Alex Vincent <ajvincent@gmail.com>
Date: Sat, 26 May 2012 20:01:35 -0700
Message-ID: <CAEZ8442Az=PDynZF6d_aQOTWZh9iaSNXmQKXcdN7Vnm2OWdvVA@mail.gmail.com>
To: whatwg@whatwg.org
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:

* 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
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
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
** 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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:42 UTC