source.html
changeset 19 e0d51f4b3b45
parent 18 bd3820a27e2d
child 20 9db51ae75f47
equal deleted inserted replaced
18:bd3820a27e2d 19:e0d51f4b3b45
     8 <body class="draft">
     8 <body class="draft">
     9 
     9 
    10 <div class="head">
    10 <div class="head">
    11 <h1>UndoManager and DOM Transaction</h1>
    11 <h1>UndoManager and DOM Transaction</h1>
    12 
    12 
    13 <h2 class="no-num no-toc">Editor's draft — 4 July 2012</h2>
    13 <h2 class="no-num no-toc">Editor's draft — 20 August 2012</h2>
    14 
    14 
    15 <dl>
    15 <dl>
    16 <dt>Editor:</dt>
    16 <dt>Editor:</dt>
    17 <dd>Ryosuke Niwa &lt;<a href="mailto:rniwa@webkit.org">rniwa@webkit.org</a>&gt;
    17 <dd>Ryosuke Niwa &lt;<a href="mailto:rniwa@webkit.org">rniwa@webkit.org</a>&gt;
    18 </dd>
    18 </dd>
    24 <dt>Latest version:</dt>
    24 <dt>Latest version:</dt>
    25 <dd><a href="http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html">
    25 <dd><a href="http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html">
    26 http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html</a></dd>
    26 http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html</a></dd>
    27 
    27 
    28 <dt>Previous versions:</dt>
    28 <dt>Previous versions:</dt>
       
    29 <dd><a href="http://dvcs.w3.org/hg/undomanager/raw-file/77b8999a67d6/undomanager.html">
       
    30 http://dvcs.w3.org/hg/undomanager/raw-file/77b8999a67d6/undomanager.html</a> (20 August 2012)</dd>
    29 <dd><a href="http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html">
    31 <dd><a href="http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html">
    30 http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html</a> (8 June 2012)</dd>
    32 http://dvcs.w3.org/hg/undomanager/raw-file/3fbf142909a7/undomanager.html</a> (8 June 2012)</dd>
    31 <dd><a href="http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html">
    33 <dd><a href="http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html">
    32 http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html</a> (29 May 2012)</dd>
    34 http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html</a> (29 May 2012)</dd>
    33 <dd><a href="http://rniwa.com/editing/undomanager-2011-03-27.html">
    35 <dd><a href="http://rniwa.com/editing/undomanager-2011-03-27.html">
   263         unless the <var title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></var> is zero, in which
   265         unless the <var title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></var> is zero, in which
   264         case there are no <a href="http://www.whatwg.org/specs/web-apps/current-work/#supported-property-indices">supported property indices</a>.</p>
   266         case there are no <a href="http://www.whatwg.org/specs/web-apps/current-work/#supported-property-indices">supported property indices</a>.</p>
   265 
   267 
   266         <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>
   268         <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>
   267         <ol>
   269         <ol>
   268             <li>If this <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   270             <li>If any <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   269                 <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   271                 <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   270                 or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, then throw
   272                 or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, then throw
   271                 <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>
   273                 <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>
   272             <li>Clear all entries between before the current <a href="#undo-position">undo position</a> without <a href="#dom-transaction-unapply">unapplying</a>
   274             <li>Clear all entries between before the current <a href="#undo-position">undo position</a> without <a href="#dom-transaction-unapply">unapplying</a>
   273             or <a href="#dom-transaction-reapply">reapplying</a> the <a href="#dom-transaction">transactions</a> in the entires.</code></li>
   275             or <a href="#dom-transaction-reapply">reapplying</a> the <a href="#dom-transaction">transactions</a> in the entires.</code></li>
   278             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>
   280             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>
   279         </ol>
   281         </ol>
   280 
   282 
   281         <p>The <dfn id="dom-undomanager-undo" title="dom-UndoManager-undo"><code>undo()</code></dfn> will</p>
   283         <p>The <dfn id="dom-undomanager-undo" title="dom-UndoManager-undo"><code>undo()</code></dfn> will</p>
   282         <ol>
   284         <ol>
   283             <li>If this <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   285             <li>If any <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   284                 <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   286                 <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   285                 or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, then throw
   287                 or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, then throw
   286                 <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>
   288                 <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>
   287             <li>If <code title="dom-UndoManager-position"><a href="#dom-undomanager-position">position</a></code> &#8804; <code title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></code>, stop.</li>
   289             <li>If <code title="dom-UndoManager-position"><a href="#dom-undomanager-position">position</a></code> &#8804; <code title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></code>, stop.</li>
   288             <li>Otherwise, <a href="#dom-transaction-unapply">unapply</a> <a href="#dom-transaction">DOM transactions</a> in the entry immediately after
   290             <li>Otherwise, <a href="#dom-transaction-unapply">unapply</a> <a href="#dom-transaction">DOM transactions</a> in the entry immediately after
   291             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>
   293             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>
   292         </ol>
   294         </ol>
   293 
   295 
   294         <p>The <dfn id="dom-undomanager-redo" title="dom-UndoManager-redo"><code>redo()</code></dfn> will</p>
   296         <p>The <dfn id="dom-undomanager-redo" title="dom-UndoManager-redo"><code>redo()</code></dfn> will</p>
   295         <ol>
   297         <ol>
   296             <li>If this <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   298             <li>If any <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   297                 <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   299                 <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   298                 or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, then throw
   300                 or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, then throw
   299                 <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>
   301                 <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             <li>If <code title="dom-UndoManager-position"><a href="#dom-undomanager-position">position</a></code> &#8804; 0, stop.</li>
   302             <li>If <code title="dom-UndoManager-position"><a href="#dom-undomanager-position">position</a></code> &#8804; 0, stop.</li>
   301             <li>Otherwise, <a href="#dom-transaction-reapply">reapply</a> <a href="#dom-transaction">DOM transactions</a> in the entry immediately before
   303             <li>Otherwise, <a href="#dom-transaction-reapply">reapply</a> <a href="#dom-transaction">DOM transactions</a> in the entry immediately before
   321         attribute must return the number of entries in the <a href="#undo-transaction-history">undo transaction history</a>.
   323         attribute must return the number of entries in the <a href="#undo-transaction-history">undo transaction history</a>.
   322         This is the <var title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></var>.</p>
   324         This is the <var title="dom-UndoManager-length"><a href="#dom-undomanager-length">length</a></var>.</p>
   323 
   325 
   324         <p>The <dfn id="dom-undomanager-clearundo" title="dom-UndoManager-clearUndo"><code>clearUndo()</code></dfn>
   326         <p>The <dfn id="dom-undomanager-clearundo" title="dom-UndoManager-clearUndo"><code>clearUndo()</code></dfn>
   325         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>
   327         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>
   326         if this <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   328         if any <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   327         <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   329         <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   328         or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, 
   330         or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, 
   329         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>,
   331         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>,
   330         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>
   332         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>
   331 
   333 
   332         <p>The <dfn id="dom-undomanager-clearredo" title="dom-UndoManager-clearRedo"><code>clearRedo()</code></dfn>
   334         <p>The <dfn id="dom-undomanager-clearredo" title="dom-UndoManager-clearRedo"><code>clearRedo()</code></dfn>
   333         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>
   335         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>
   334         if this <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   336         if any <code><a href="#undomanager">UndoManager</a></code> is already in the process of <a href="#dom-transaction-apply">applying</a>,
   335         <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   337         <a href="#dom-transaction-unapply">unapplying</a>, or <a href="#dom-transaction-reapply">reapplying</a> a <a href="#dom-transaction">DOM transaction</a>,
   336         or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, 
   338         or the <code><a href="#undomanager">UndoManager</a></code> had been <a href="#disconnect-undomanager">disconnected</a>, 
   337         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>
   339         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>
   338 
   340 
   339         <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.
   341         <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.