undomanager.html
changeset 19 e0d51f4b3b45
parent 18 bd3820a27e2d
child 20 9db51ae75f47
equal deleted inserted replaced
18:bd3820a27e2d 19:e0d51f4b3b45
     6 <body class=draft>
     6 <body class=draft>
     7 
     7 
     8 <div class=head>
     8 <div class=head>
     9 <h1>UndoManager and DOM Transaction</h1>
     9 <h1>UndoManager and DOM Transaction</h1>
    10 
    10 
    11 <h2 class="no-num no-toc" id="editor's-draft-&mdash;-4-july-2012">Editor's draft &mdash; 4 July 2012</h2>
    11 <h2 class="no-num no-toc" id="editor's-draft-&mdash;-20-august-2012">Editor's draft &mdash; 20 August 2012</h2>
    12 
    12 
    13 <dl>
    13 <dl>
    14 <dt>Editor:</dt>
    14 <dt>Editor:</dt>
    15 <dd>Ryosuke Niwa &lt;<a href=mailto:rniwa@webkit.org>rniwa@webkit.org</a>&gt;
    15 <dd>Ryosuke Niwa &lt;<a href=mailto:rniwa@webkit.org>rniwa@webkit.org</a>&gt;
    16 </dd>
    16 </dd>
    22 <dt>Latest version:</dt>
    22 <dt>Latest version:</dt>
    23 <dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html>
    23 <dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html>
    24 http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html</a></dd>
    24 http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html</a></dd>
    25 
    25 
    26 <dt>Previous versions:</dt>
    26 <dt>Previous versions:</dt>
       
    27 <dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/77b8999a67d6/undomanager.html>
       
    28 http://dvcs.w3.org/hg/undomanager/raw-file/77b8999a67d6/undomanager.html</a> (20 August 2012)</dd>
    27 <dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html>
    29 <dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html>
    28 http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html</a> (8 June 2012)</dd>
    30 http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html</a> (8 June 2012)</dd>
    29 <dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html>
    31 <dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html>
    30 http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html</a> (29 May 2012)</dd>
    32 http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html</a> (29 May 2012)</dd>
    31 <dd><a href=http://rniwa.com/editing/undomanager-2011-03-27.html>
    33 <dd><a href=http://rniwa.com/editing/undomanager-2011-03-27.html>
   290         unless the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var> is zero, in which
   292         unless the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var> is zero, in which
   291         case there are no <a href=http://www.whatwg.org/specs/web-apps/current-work/#supported-property-indices>supported property indices</a>.</p>
   293         case there are no <a href=http://www.whatwg.org/specs/web-apps/current-work/#supported-property-indices>supported property indices</a>.</p>
   292 
   294 
   293         <p>The <dfn id=dom-undomanager-transact title=dom-UndoManager-transact><code>transact(<var title="">transaction</var>, <var title="">merge</var>)</code></dfn> will</p>
   295         <p>The <dfn id=dom-undomanager-transact title=dom-UndoManager-transact><code>transact(<var title="">transaction</var>, <var title="">merge</var>)</code></dfn> will</p>
   294         <ol>
   296         <ol>
   295             <li>If this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   297             <li>If any <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   296                 <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   298                 <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   297                 or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
   299                 or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
   298                 <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>
   300                 <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>
   299             <li>Clear all entries between before the current <a href=#undo-position>undo position</a> without <a href=#dom-transaction-unapply>unapplying</a>
   301             <li>Clear all entries between before the current <a href=#undo-position>undo position</a> without <a href=#dom-transaction-unapply>unapplying</a>
   300             or <a href=#dom-transaction-reapply>reapplying</a> the <a href=#dom-transaction>transactions</a> in the entires.</li>
   302             or <a href=#dom-transaction-reapply>reapplying</a> the <a href=#dom-transaction>transactions</a> in the entires.</li>
   305             of this <code><a href=#undomanager>UndoManager</a></code> if the <code><a href=#undomanager>UndoManager</a></code> had not already been <a href=#disconnect-undomanager>disconnected</a>.</li>
   307             of this <code><a href=#undomanager>UndoManager</a></code> if the <code><a href=#undomanager>UndoManager</a></code> had not already been <a href=#disconnect-undomanager>disconnected</a>.</li>
   306         </ol>
   308         </ol>
   307 
   309 
   308         <p>The <dfn id=dom-undomanager-undo title=dom-UndoManager-undo><code>undo()</code></dfn> will</p>
   310         <p>The <dfn id=dom-undomanager-undo title=dom-UndoManager-undo><code>undo()</code></dfn> will</p>
   309         <ol>
   311         <ol>
   310             <li>If this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   312             <li>If any <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   311                 <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   313                 <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   312                 or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
   314                 or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
   313                 <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>
   315                 <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>
   314             <li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &le; <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code>, stop.</li>
   316             <li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &le; <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code>, stop.</li>
   315             <li>Otherwise, <a href=#dom-transaction-unapply>unapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately after
   317             <li>Otherwise, <a href=#dom-transaction-unapply>unapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately after
   318             of this <code><a href=#undomanager>UndoManager</a></code> if the <code><a href=#undomanager>UndoManager</a></code> had not already been <a href=#disconnect-undomanager>disconnected</a>.</li>
   320             of this <code><a href=#undomanager>UndoManager</a></code> if the <code><a href=#undomanager>UndoManager</a></code> had not already been <a href=#disconnect-undomanager>disconnected</a>.</li>
   319         </ol>
   321         </ol>
   320 
   322 
   321         <p>The <dfn id=dom-undomanager-redo title=dom-UndoManager-redo><code>redo()</code></dfn> will</p>
   323         <p>The <dfn id=dom-undomanager-redo title=dom-UndoManager-redo><code>redo()</code></dfn> will</p>
   322         <ol>
   324         <ol>
   323             <li>If this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   325             <li>If any <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   324                 <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   326                 <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   325                 or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
   327                 or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
   326                 <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>
   328                 <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>
   327             <li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &le; 0, stop.</li>
   329             <li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &le; 0, stop.</li>
   328             <li>Otherwise, <a href=#dom-transaction-reapply>reapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately before
   330             <li>Otherwise, <a href=#dom-transaction-reapply>reapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately before
   348         attribute must return the number of entries in the <a href=#undo-transaction-history>undo transaction history</a>.
   350         attribute must return the number of entries in the <a href=#undo-transaction-history>undo transaction history</a>.
   349         This is the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var>.</p>
   351         This is the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var>.</p>
   350 
   352 
   351         <p>The <dfn id=dom-undomanager-clearundo title=dom-UndoManager-clearUndo><code>clearUndo()</code></dfn>
   353         <p>The <dfn id=dom-undomanager-clearundo title=dom-UndoManager-clearUndo><code>clearUndo()</code></dfn>
   352         method must 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>
   354         method must 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>
   353         if this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   355         if any <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   354         <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   356         <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   355         or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, 
   357         or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, 
   356         otherwise it must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> before the <a href=#undo-position>undo position</a>,
   358         otherwise it must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> before the <a href=#undo-position>undo position</a>,
   357         and move the <a href=#undo-position>undo position</a> to the top (set <a href=#dom-undomanager-position>position</a> to zero).</p>
   359         and move the <a href=#undo-position>undo position</a> to the top (set <a href=#dom-undomanager-position>position</a> to zero).</p>
   358 
   360 
   359         <p>The <dfn id=dom-undomanager-clearredo title=dom-UndoManager-clearRedo><code>clearRedo()</code></dfn>
   361         <p>The <dfn id=dom-undomanager-clearredo title=dom-UndoManager-clearRedo><code>clearRedo()</code></dfn>
   360         method must 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>
   362         method must 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>
   361         if this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   363         if any <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
   362         <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   364         <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
   363         or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, 
   365         or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, 
   364         otherwise it 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>
   366         otherwise it 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>
   365 
   367 
   366         <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.
   368         <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.