Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Also swap the normative definitions of clearUndo and clearRedo to codify my intention.
--- a/source.html Tue May 29 22:23:12 2012 -0700
+++ b/source.html Tue May 29 22:44:17 2012 -0700
@@ -240,10 +240,8 @@
<li>Clear all entries between before the current <a href="#undo-position">undo position</a> without <a href="#dom-transaction-unapply">unapplying</a>
or <a href="#dom-transaction-reapply">reapplying</a> the <a href="#dom-transaction">transactions</a> in the entires.</code></li>
<li><a href="#dom-transaction-apply">Apply</a> the <var title="">transaction</var>.</li>
- <li>If <var title="">merge</var> is not set to true or there are no entries in the <a href="#undo-transaction-history">undo transaction history</a>,
- create a new entry with exactly one transaction <var title="">transaction</var> and add it to the top of
- the <a href="#undo-transaction-history">undo transaction history</a> and go to step 6.</li>
- <li>Otherwise, add <var title="">transaction</var> to the first entry in the <a href="#undo-transaction-history">undo transaction history</a>.</li>
+ <li>If <var title="">merge</var> is set to true, add an empty entry to the beginning of the <a href="#undo-transaction-history">undo transaction history</a>.</li>
+ <li>Add the applied transaction to the beginning of the first entry in the <a href="#undo-transaction-history">undo transaction history</a>.</li>
<li><a href="#fire-a-dom-transaction-event">Fire a DOM transaction event</a> for the transaction applied in step 3 at the <a href="#undo-scope-host">undo scope host</a>
of this <code><a href="#undomanager">UndoManager</a></code> if <a href="#undo-scope-host">undo scope host</a> is still in the document and <code><a href="#undomanager">UndoManager</a></code>
had not already been destroyed.</li>
@@ -254,9 +252,8 @@
<li>If <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>, <a href="#dom-transaction-unapply">unapplying</a>,
or <a href="dom-transaction-reapply">reapplying</a>, then throw <code class="external"><a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR">INVALID_ACCESS_ERR</a></code> and stop.</li>
<li>If <code title="dom-UndoManager-position"><a href="#dom-undomanager-position">position</a></code> ≤ <code title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></code>, stop.</li>
- <li>Otherwise, <a href="#dom-transaction-unapply">unapply</a> transactions t<sub>n</sub>, t<sub>n-1</sub>, ... t<sub>1</sub> where
- t<sub>1</sub>, t<sub>2</sub>, ... t<sub>n</sub> is the sequence of <a href="#dom-transaction">DOM transactions</a> for the entry immediately after
- the <a href="#undo-position">undo position</a> and increment <a href="#dom-undomanager-position">position</a></code> by 1.</li>
+ <li>Otherwise, <a href="#dom-transaction-unapply">unapply</a> <a href="#dom-transaction">DOM transactions</a> in the entry immediately after
+ the <a href="#undo-position">undo position</a> in the order and increment <a href="#dom-undomanager-position">position</a></code> by 1.</li>
<li><a href="#fire-an-undo-event">Fire an undo event</a> for the transaction unapplied in step 3 at the <a href="#undo-scope-host">undo scope host</a> of this <code><a href="#undomanager">UndoManager</a></code>
if <a href="#undo-scope-host">undo scope host</a> is still in the document and <code><a href="#undomanager">UndoManager</a></code> had not already been destroyed.</li>
</ol>
@@ -266,9 +263,8 @@
<li>If <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>, <a href="#dom-transaction-unapply">unapplying</a>,
or <a href="dom-transaction-reapply">reapplying</a>, then throw <code class="external"><a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR">INVALID_ACCESS_ERR</a></code> and stop.</li>
<li>If <code title="dom-UndoManager-position"><a href="#dom-undomanager-position">position</a></code> ≤ 0, stop.</li>
- <li>Otherwise, <a href="#dom-transaction-reapply">reapply</a> transactions t<sub>1</sub>, t<sub>2</sub>, ... t<sub>n</sub> where
- t<sub>1</sub>, t<sub>2</sub>, ... t<sub>n</sub> is the sequence of <a href="#dom-transaction">DOM transactions</a> for the entry immediately before
- the <a href="#undo-position">undo position</a> and decrement <a href="#dom-undomanager-position">position</a></code> by 1.</li>
+ <li>Otherwise, <a href="#dom-transaction-reapply">reapply</a> <a href="#dom-transaction">DOM transactions</a> in the entry immediately before
+ the <a href="#undo-position">undo position</a> in the reverse order and decrement <a href="#dom-undomanager-position">position</a></code> by 1.</li>
<li><a href="#fire-a-redo-event">Fire a redo event</a> for the transaction unapplied in step 3 at the <a href="#undo-scope-host">undo scope host</a> of this <code><a href="#undomanager">UndoManager</a></code>
if <a href="#undo-scope-host">undo scope host</a> is still in the document and <code><a href="#undomanager">UndoManager</a></code> had not already been destroyed.</li>
</ol>
@@ -291,11 +287,11 @@
This is the <var title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></var>.</p>
<p>The <dfn id="dom-undomanager-clearundo" title="dom-UndoManager-clearUndo"><code>clearUndo()</code></dfn>
- method must remove all entries in the <a href="#undo-transaction-history">undo transaction history</a> after the <a href="#undo-position">undo position</a>.</p>
+ method must remove all entries in the <a href="#undo-transaction-history">undo transaction history</a> before the <a href="#undo-position">undo position</a>,
+ and move the <a href="#undo-position">undo position</a> to the top (set <a href="#dom-undomanager-position">position</a></code> to zero).</p>
<p>The <dfn id="dom-undomanager-clearredo" title="dom-UndoManager-clearRedo"><code>clearRedo()</code></dfn>
- method must remove all entries in the <a href="#undo-transaction-history">undo transaction history</a> before the <a href="#undo-position">undo position</a>,
- and move the <a href="#undo-position">undo position</a> to the top (set <a href="#dom-undomanager-position">position</a></code> to zero).</p>
+ method must remove all entries in the <a href="#undo-transaction-history">undo transaction history</a> after the <a href="#undo-position">undo position</a>.</p>
<p><dfn id="the-active-undo-manager">The active undo manager</dfn> is the <code><a href="#undomanager">UndoManager</a></code> of the focused node in the document.
If no node has focus, then it's assumed to be of the document.</p>
--- a/undomanager.html Tue May 29 22:23:12 2012 -0700
+++ b/undomanager.html Tue May 29 22:44:17 2012 -0700
@@ -268,10 +268,8 @@
<li>Clear all entries between before the current <a href=#undo-position>undo position</a> without <a href=#dom-transaction-unapply>unapplying</a>
or <a href=#dom-transaction-reapply>reapplying</a> the <a href=#dom-transaction>transactions</a> in the entires.</li>
<li><a href=#dom-transaction-apply>Apply</a> the <var title="">transaction</var>.</li>
- <li>If <var title="">merge</var> is not set to true or there are no entries in the <a href=#undo-transaction-history>undo transaction history</a>,
- create a new entry with exactly one transaction <var title="">transaction</var> and add it to the top of
- the <a href=#undo-transaction-history>undo transaction history</a> and go to step 6.</li>
- <li>Otherwise, add <var title="">transaction</var> to the first entry in the <a href=#undo-transaction-history>undo transaction history</a>.</li>
+ <li>If <var title="">merge</var> is set to true, add an empty entry to the beginning of the <a href=#undo-transaction-history>undo transaction history</a>.</li>
+ <li>Add the applied transaction to the beginning of the first entry in the <a href=#undo-transaction-history>undo transaction history</a>.</li>
<li><a href=#fire-a-dom-transaction-event>Fire a DOM transaction event</a> for the transaction applied in step 3 at the <a href=#undo-scope-host>undo scope host</a>
of this <code><a href=#undomanager>UndoManager</a></code> if <a href=#undo-scope-host>undo scope host</a> is still in the document and <code><a href=#undomanager>UndoManager</a></code>
had not already been destroyed.</li>
@@ -282,9 +280,8 @@
<li>If <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>, <a href=#dom-transaction-unapply>unapplying</a>,
or <a href=dom-transaction-reapply>reapplying</a>, then throw <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code> and stop.</li>
<li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> ≤ <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code>, stop.</li>
- <li>Otherwise, <a href=#dom-transaction-unapply>unapply</a> transactions t<sub>n</sub>, t<sub>n-1</sub>, ... t<sub>1</sub> where
- t<sub>1</sub>, t<sub>2</sub>, ... t<sub>n</sub> is the sequence of <a href=#dom-transaction>DOM transactions</a> for the entry immediately after
- the <a href=#undo-position>undo position</a> and increment <a href=#dom-undomanager-position>position</a> by 1.</li>
+ <li>Otherwise, <a href=#dom-transaction-unapply>unapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately after
+ the <a href=#undo-position>undo position</a> in the order and increment <a href=#dom-undomanager-position>position</a> by 1.</li>
<li><a href=#fire-an-undo-event>Fire an undo event</a> for the transaction unapplied in step 3 at the <a href=#undo-scope-host>undo scope host</a> of this <code><a href=#undomanager>UndoManager</a></code>
if <a href=#undo-scope-host>undo scope host</a> is still in the document and <code><a href=#undomanager>UndoManager</a></code> had not already been destroyed.</li>
</ol>
@@ -294,9 +291,8 @@
<li>If <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>, <a href=#dom-transaction-unapply>unapplying</a>,
or <a href=dom-transaction-reapply>reapplying</a>, then throw <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code> and stop.</li>
<li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> ≤ 0, stop.</li>
- <li>Otherwise, <a href=#dom-transaction-reapply>reapply</a> transactions t<sub>1</sub>, t<sub>2</sub>, ... t<sub>n</sub> where
- t<sub>1</sub>, t<sub>2</sub>, ... t<sub>n</sub> is the sequence of <a href=#dom-transaction>DOM transactions</a> for the entry immediately before
- the <a href=#undo-position>undo position</a> and decrement <a href=#dom-undomanager-position>position</a> by 1.</li>
+ <li>Otherwise, <a href=#dom-transaction-reapply>reapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately before
+ the <a href=#undo-position>undo position</a> in the reverse order and decrement <a href=#dom-undomanager-position>position</a> by 1.</li>
<li><a href=#fire-a-redo-event>Fire a redo event</a> for the transaction unapplied in step 3 at the <a href=#undo-scope-host>undo scope host</a> of this <code><a href=#undomanager>UndoManager</a></code>
if <a href=#undo-scope-host>undo scope host</a> is still in the document and <code><a href=#undomanager>UndoManager</a></code> had not already been destroyed.</li>
</ol>
@@ -319,11 +315,11 @@
This is the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var>.</p>
<p>The <dfn id=dom-undomanager-clearundo title=dom-UndoManager-clearUndo><code>clearUndo()</code></dfn>
- method must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> after the <a href=#undo-position>undo position</a>.</p>
+ method must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> before the <a href=#undo-position>undo position</a>,
+ and move the <a href=#undo-position>undo position</a> to the top (set <a href=#dom-undomanager-position>position</a> to zero).</p>
<p>The <dfn id=dom-undomanager-clearredo title=dom-UndoManager-clearRedo><code>clearRedo()</code></dfn>
- method must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> before the <a href=#undo-position>undo position</a>,
- and move the <a href=#undo-position>undo position</a> to the top (set <a href=#dom-undomanager-position>position</a> to zero).</p>
+ method must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> after the <a href=#undo-position>undo position</a>.</p>
<p><dfn id=the-active-undo-manager>The active undo manager</dfn> is the <code><a href=#undomanager>UndoManager</a></code> of the focused node in the document.
If no node has focus, then it's assumed to be of the document.</p>