Skip to content

Commit

Permalink
[] (0) Cleanup in Undo Manager section.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@3891 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 18, 2009
1 parent 4fcf7eb commit 5afb34a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 133 deletions.
103 changes: 27 additions & 76 deletions index
Expand Up @@ -834,20 +834,19 @@
<li><a href=#security-risks-in-the-drag-and-drop-model><span class=secno>7.9.7 </span>Security risks in the drag-and-drop model</a></ol></li>
<li><a href=#undo><span class=secno>7.10 </span>Undo history</a>
<ol>
<li><a href=#introduction-5><span class=secno>7.10.1 </span>Introduction</a></li>
<li><a href=#definitions-2><span class=secno>7.10.2 </span>Definitions</a></li>
<li><a href=#the-undomanager-interface><span class=secno>7.10.3 </span>The <code>UndoManager</code> interface</a></li>
<li><a href=#undo:-moving-back-in-the-undo-transaction-history><span class=secno>7.10.4 </span>Undo: moving back in the undo transaction history</a></li>
<li><a href=#redo:-moving-forward-in-the-undo-transaction-history><span class=secno>7.10.5 </span>Redo: moving forward in the undo transaction history</a></li>
<li><a href=#the-undomanagerevent-interface-and-the-undo-and-redo-events><span class=secno>7.10.6 </span>The <code>UndoManagerEvent</code> interface and the <code title=event-undo>undo</code> and <code title=event-redo>redo</code> events</a></li>
<li><a href=#implementation-notes><span class=secno>7.10.7 </span>Implementation notes</a></ol></li>
<li><a href=#definitions-2><span class=secno>7.10.1 </span>Definitions</a></li>
<li><a href=#the-undomanager-interface><span class=secno>7.10.2 </span>The <code>UndoManager</code> interface</a></li>
<li><a href=#undo:-moving-back-in-the-undo-transaction-history><span class=secno>7.10.3 </span>Undo: moving back in the undo transaction history</a></li>
<li><a href=#redo:-moving-forward-in-the-undo-transaction-history><span class=secno>7.10.4 </span>Redo: moving forward in the undo transaction history</a></li>
<li><a href=#the-undomanagerevent-interface-and-the-undo-and-redo-events><span class=secno>7.10.5 </span>The <code>UndoManagerEvent</code> interface and the <code title=event-undo>undo</code> and <code title=event-redo>redo</code> events</a></li>
<li><a href=#implementation-notes><span class=secno>7.10.6 </span>Implementation notes</a></ol></li>
<li><a href=#editing-apis><span class=secno>7.11 </span>Editing APIs</a></ol></li>
<li><a href=#comms><span class=secno>8 </span>Communication</a>
<ol>
<li><a href=#event-definitions><span class=secno>8.1 </span>Event definitions</a></li>
<li><a href=#crossDocumentMessages><span class=secno>8.2 </span>Cross-document messaging</a>
<ol>
<li><a href=#introduction-6><span class=secno>8.2.1 </span>Introduction</a></li>
<li><a href=#introduction-5><span class=secno>8.2.1 </span>Introduction</a></li>
<li><a href=#security-4><span class=secno>8.2.2 </span>Security</a>
<ol>
<li><a href=#authors><span class=secno>8.2.2.1 </span>Authors</a></li>
Expand All @@ -856,7 +855,7 @@
<li><a href=#posting-messages-with-message-ports><span class=secno>8.2.4 </span>Posting messages with message ports</a></ol></li>
<li><a href=#channel-messaging><span class=secno>8.3 </span>Channel messaging</a>
<ol>
<li><a href=#introduction-7><span class=secno>8.3.1 </span>Introduction</a></li>
<li><a href=#introduction-6><span class=secno>8.3.1 </span>Introduction</a></li>
<li><a href=#message-channels><span class=secno>8.3.2 </span>Message channels</a></li>
<li><a href=#message-ports><span class=secno>8.3.3 </span>Message ports</a>
<ol>
Expand Down Expand Up @@ -985,10 +984,10 @@
<li><a href=#parsing-xhtml-fragments><span class=secno>10.4 </span>Parsing XHTML fragments</a></ol></li>
<li><a href=#rendering><span class=secno>11 </span>Rendering</a>
<ol>
<li><a href=#introduction-8><span class=secno>11.1 </span>Introduction</a></li>
<li><a href=#introduction-7><span class=secno>11.1 </span>Introduction</a></li>
<li><a href=#the-css-user-agent-style-sheet-and-presentational-hints><span class=secno>11.2 </span>The CSS user agent style sheet and presentational hints</a>
<ol>
<li><a href=#introduction-9><span class=secno>11.2.1 </span>Introduction</a></li>
<li><a href=#introduction-8><span class=secno>11.2.1 </span>Introduction</a></li>
<li><a href=#display-types><span class=secno>11.2.2 </span>Display types</a></li>
<li><a href=#margins-and-padding><span class=secno>11.2.3 </span>Margins and padding</a></li>
<li><a href=#alignment><span class=secno>11.2.4 </span>Alignment</a></li>
Expand All @@ -1006,7 +1005,7 @@
<li><a href=#tool-bars-0><span class=secno>11.3.5 </span>Tool bars</a></ol></li>
<li><a href=#bindings><span class=secno>11.4 </span>Bindings</a>
<ol>
<li><a href=#introduction-10><span class=secno>11.4.1 </span>Introduction</a></li>
<li><a href=#introduction-9><span class=secno>11.4.1 </span>Introduction</a></li>
<li><a href=#the-button-element-0><span class=secno>11.4.2 </span>The <code>button</code> element</a></li>
<li><a href=#the-details-element-0><span class=secno>11.4.3 </span>The <code>details</code> element</a></li>
<li><a href=#the-input-element-as-a-text-entry-widget><span class=secno>11.4.4 </span>The <code>input</code> element as a text entry widget</a></li>
Expand Down Expand Up @@ -59194,23 +59193,15 @@ style/default.css</pre>

<h3 id=undo><span class=secno>7.10 </span><dfn>Undo history</dfn></h3>

<p class=XXX>There has got to be a better way of doing this, surely.</p>


<h4 id=introduction-5><span class=secno>7.10.1 </span>Introduction</h4>

<p class=XXX>...</p>


<div class=impl>

<h4 id=definitions-2><span class=secno>7.10.2 </span>Definitions</h4>
<h4 id=definitions-2><span class=secno>7.10.1 </span>Definitions</h4>

<p>The user agent must associate an <dfn id=undo-transaction-history>undo transaction
history</dfn> with each <code><a href=#htmldocument>HTMLDocument</a></code> object.</p>

<p>The <a href=#undo-transaction-history>undo transaction history</a> is a list of
entries. The entries are of two type: <a href=#dom-changes>DOM changes</a> and
entries. The entries are of two types: <a href=#dom-changes>DOM changes</a> and
<a href=#undo-object title="undo object">undo objects</a>.</p>

<p>Each <dfn id=dom-changes>DOM changes</dfn> entry in the <a href=#undo-transaction-history>undo transaction
Expand All @@ -59220,14 +59211,13 @@ style/default.css</pre>
<ul><li>Changes to the content attributes of an <code>Element</code>
node.</li>

<li>Changes to the IDL attributes of a <code>Node</code>.</li> <!--
XXX uh, these change on their own, so clearly this isn't going to
fly. Which IDL attributes, exactly? -->

<li>Changes to the DOM hierarchy of nodes that are descendants of
the <code><a href=#htmldocument>HTMLDocument</a></code> object (<code>parentNode</code>,
<code>childNodes</code>).</li>

<li>Changes to internal state, such as a form control's <a href=#concept-fe-value title=concept-fe-value>value</a> or <a href=#concept-input-checked-dirty-flag title=concept-input-checked-dirty-flag>dirty checkedness
flag</a>.</li>

</ul><p><dfn id=undo-object>Undo object</dfn> entries consist of objects representing
state that scripts running in the document are managing. For
example, a Web mail application could use an <a href=#undo-object>undo
Expand All @@ -59245,33 +59235,7 @@ style/default.css</pre>
</div>


<h4 id=the-undomanager-interface><span class=secno>7.10.3 </span>The <code><a href=#undomanager>UndoManager</a></code> interface</h4>

<div class=impl>

<div class=XXX>

<p>This API sucks. Seriously. It's a terrible API. Really bad. I
hate it. Here are the requirements:</p>

<ul><li>Has to cope with cases where the server has undo state already
when the page is loaded, that can be stuffed into the undo buffer
onload.</li>

<li>Has to support undo/redo.</li>

<li>Has to cope with the "undo" action being "contact the server
and tell it to undo", rather than it being the opposite of the
"redo" action.</li>

<li>Has to cope with some undo states expiring from the undo
history (e.g. server can only remember one undelete action) but
other states not expiring (e.g. client can undo arbitrary amounts
of local edits).</li>

</ul></div>

</div>
<h4 id=the-undomanager-interface><span class=secno>7.10.2 </span>The <code><a href=#undomanager>UndoManager</a></code> interface</h4>

<p>To manage <a href=#undo-object>undo object</a> entries in the <a href=#undo-transaction-history>undo
transaction history</a>, the <code><a href=#undomanager>UndoManager</a></code>
Expand Down Expand Up @@ -59373,7 +59337,7 @@ style/default.css</pre>
case there are no <span>supported indexed properties</span>.</p>

<p>The <dfn id=dom-undomanager-item title=dom-UndoManager-item><code>item(<var title="">n</var>)</code></dfn> method must return the <var title="">n</var>th <a href=#undo-object>undo object</a> entry in the <a href=#undo-transaction-history>undo
transaction history</a>.</p> <!-- XXX out of range handling? -->
transaction history</a>, if there is one, or null otherwise.</p>

<p>The <a href=#undo-transaction-history>undo transaction history</a> has a <dfn id=undo-position title="undo
position">current position</dfn>. This is the position between two
Expand Down Expand Up @@ -59415,15 +59379,6 @@ style/default.css</pre>
position</a> must be removed (as if <code title=dom-UndoManager-clearRedo><a href=#dom-undomanager-clearredo>clearRedo()</a></code> had been
called).</p>

<p class=XXX>We could fire events when someone adds
something to the undo history -- one event per undo object entry
before the position (or after, during redo addition), allowing the
script to decide if that entry should remain or not. Or
something. Would make it potentially easier to expire server-held
state when the server limitations come into play.</p>

<!-- XXX note on expiring undo in case server can only do one level undo -->

<p>The <dfn id=dom-undomanager-remove title=dom-UndoManager-remove><code>remove(<var title="">index</var>)</code></dfn> method must remove the <a href=#undo-object>undo
object</a> entry with the specified <var title="">index</var>. If
the index is less than zero or greater than or equal to <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code> then the method must
Expand All @@ -59442,16 +59397,12 @@ style/default.css</pre>
<a href=#dom-changes>DOM changes</a> entries or <a href=#undo-object>undo object</a>
entries.</p>

<p class=XXX>Another idea is to have a way for scripts to
say "startBatchingDOMChangesForUndo()" and after that the changes to
the DOM go in as if the user had done them.</p>

</div>


<div class=impl>

<h4 id=undo:-moving-back-in-the-undo-transaction-history><span class=secno>7.10.4 </span><dfn title=do-undo>Undo: moving back in the undo transaction history</dfn></h4>
<h4 id=undo:-moving-back-in-the-undo-transaction-history><span class=secno>7.10.3 </span><dfn title=do-undo>Undo: moving back in the undo transaction history</dfn></h4>

<p>When the user invokes an undo operation, or when the <code title=dom-document-execCommand><a href=#execCommand>execCommand()</a></code> method is
called with the <code title=command-undo><a href=#command-undo>undo</a></code> command, the
Expand Down Expand Up @@ -59488,7 +59439,7 @@ style/default.css</pre>
command to undo his undo.</p>


<h4 id=redo:-moving-forward-in-the-undo-transaction-history><span class=secno>7.10.5 </span><dfn title=do-redo>Redo: moving forward in the undo transaction history</dfn></h4>
<h4 id=redo:-moving-forward-in-the-undo-transaction-history><span class=secno>7.10.4 </span><dfn title=do-redo>Redo: moving forward in the undo transaction history</dfn></h4>

<p>When the user invokes a redo operation, or when the <code title=dom-document-execCommand><a href=#execCommand>execCommand()</a></code> method is
called with the <code title=command-redo><a href=#command-redo>redo</a></code> command, the
Expand Down Expand Up @@ -59525,7 +59476,7 @@ style/default.css</pre>
</div>


<h4 id=the-undomanagerevent-interface-and-the-undo-and-redo-events><span class=secno>7.10.6 </span>The <code><a href=#undomanagerevent>UndoManagerEvent</a></code> interface and the <code title=event-undo><a href=#event-undo>undo</a></code> and <code title=event-redo><a href=#event-redo>redo</a></code> events</h4>
<h4 id=the-undomanagerevent-interface-and-the-undo-and-redo-events><span class=secno>7.10.5 </span>The <code><a href=#undomanagerevent>UndoManagerEvent</a></code> interface and the <code title=event-undo><a href=#event-undo>undo</a></code> and <code title=event-redo><a href=#event-redo>redo</a></code> events</h4>

<pre class=idl>interface <dfn id=undomanagerevent>UndoManagerEvent</dfn> : Event {
readonly attribute any <a href=#dom-undomanagerevent-data title=dom-UndoManagerEvent-data>data</a>;
Expand Down Expand Up @@ -59562,7 +59513,7 @@ style/default.css</pre>

<div class=impl>

<h4 id=implementation-notes><span class=secno>7.10.7 </span>Implementation notes</h4>
<h4 id=implementation-notes><span class=secno>7.10.6 </span>Implementation notes</h4>

<p>How user agents present the above conceptual model to the user is
not defined. The undo interface could be a filtered view of the
Expand Down Expand Up @@ -60175,7 +60126,7 @@ XXX Once we resolve the style="" issue, address these:
</div>


<h4 id=introduction-6><span class=secno>8.2.1 </span>Introduction</h4>
<h4 id=introduction-5><span class=secno>8.2.1 </span>Introduction</h4>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -60481,7 +60432,7 @@ function receiver(e) {

<h3 id=channel-messaging><span class=secno>8.3 </span><dfn>Channel messaging</dfn></h3>

<h4 id=introduction-7><span class=secno>8.3.1 </span>Introduction</h4>
<h4 id=introduction-6><span class=secno>8.3.1 </span>Introduction</h4>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -71116,7 +71067,7 @@ http://lxr.mozilla.org/seamonkey/search?string=nested
lead to this experience.</i></p>


<h3 id=introduction-8><span class=secno>11.1 </span>Introduction</h3>
<h3 id=introduction-7><span class=secno>11.1 </span>Introduction</h3>

<p>In general, user agents are expected to support CSS, and many of
the suggestions in this section are expressed in CSS terms. User
Expand Down Expand Up @@ -71154,7 +71105,7 @@ http://lxr.mozilla.org/seamonkey/search?string=nested

<h3 id=the-css-user-agent-style-sheet-and-presentational-hints><span class=secno>11.2 </span>The CSS user agent style sheet and presentational hints</h3>

<h4 id=introduction-9><span class=secno>11.2.1 </span>Introduction</h4>
<h4 id=introduction-8><span class=secno>11.2.1 </span>Introduction</h4>

<p>The CSS rules given in these subsections are, unless otherwise
specified, expected to be used as part of the user-agent level style
Expand Down Expand Up @@ -72326,7 +72277,7 @@ object[align=bottom] {

<h3 id=bindings><span class=secno>11.4 </span>Bindings</h3>

<h4 id=introduction-10><span class=secno>11.4.1 </span>Introduction</h4>
<h4 id=introduction-9><span class=secno>11.4.1 </span>Introduction</h4>

<p>A number of elements have their rendering defined in terms of the
'binding' property. <a href=#refsBECSS>[BECSS]</a></p>
Expand Down
64 changes: 7 additions & 57 deletions source
Expand Up @@ -69050,14 +69050,6 @@ interface <dfn>SQLTransactionSync</dfn> {

<h3 id="undo"><dfn>Undo history</dfn></h3>

<p class="XXX">There has got to be a better way of doing this, surely.</p>


<h4>Introduction</h4>

<p class="XXX">...</p>


<div class="impl">

<h4>Definitions</h4>
Expand All @@ -69066,7 +69058,7 @@ interface <dfn>SQLTransactionSync</dfn> {
history</dfn> with each <code>HTMLDocument</code> object.</p>

<p>The <span>undo transaction history</span> is a list of
entries. The entries are of two type: <span>DOM changes</span> and
entries. The entries are of two types: <span>DOM changes</span> and
<span title="undo object">undo objects</span>.</p>

<p>Each <dfn>DOM changes</dfn> entry in the <span>undo transaction
Expand All @@ -69078,14 +69070,15 @@ interface <dfn>SQLTransactionSync</dfn> {
<li>Changes to the content attributes of an <code>Element</code>
node.</li>

<li>Changes to the IDL attributes of a <code>Node</code>.</li> <!--
XXX uh, these change on their own, so clearly this isn't going to
fly. Which IDL attributes, exactly? -->

<li>Changes to the DOM hierarchy of nodes that are descendants of
the <code>HTMLDocument</code> object (<code>parentNode</code>,
<code>childNodes</code>).</li>

<li>Changes to internal state, such as a form control's <span
title="concept-fe-value">value</span> or <span
title="concept-input-checked-dirty-flag">dirty checkedness
flag</span>.</li>

</ul>

<p><dfn>Undo object</dfn> entries consist of objects representing
Expand All @@ -69107,36 +69100,6 @@ interface <dfn>SQLTransactionSync</dfn> {

<h4>The <code>UndoManager</code> interface</h4>

<div class="impl">

<div class="XXX">

<p>This API sucks. Seriously. It's a terrible API. Really bad. I
hate it. Here are the requirements:</p>

<ul>

<li>Has to cope with cases where the server has undo state already
when the page is loaded, that can be stuffed into the undo buffer
onload.</li>

<li>Has to support undo/redo.</li>

<li>Has to cope with the "undo" action being "contact the server
and tell it to undo", rather than it being the opposite of the
"redo" action.</li>

<li>Has to cope with some undo states expiring from the undo
history (e.g. server can only remember one undelete action) but
other states not expiring (e.g. client can undo arbitrary amounts
of local edits).</li>

</ul>

</div>

</div>

<p>To manage <span>undo object</span> entries in the <span>undo
transaction history</span>, the <code>UndoManager</code>
interface can be used:</p>
Expand Down Expand Up @@ -69245,7 +69208,7 @@ interface <dfn>SQLTransactionSync</dfn> {
<p>The <dfn title="dom-UndoManager-item"><code>item(<var
title="">n</var>)</code></dfn> method must return the <var
title="">n</var>th <span>undo object</span> entry in the <span>undo
transaction history</span>.</p> <!-- XXX out of range handling? -->
transaction history</span>, if there is one, or null otherwise.</p>

<p>The <span>undo transaction history</span> has a <dfn title="undo
position">current position</dfn>. This is the position between two
Expand Down Expand Up @@ -69295,15 +69258,6 @@ interface <dfn>SQLTransactionSync</dfn> {
title="dom-UndoManager-clearRedo">clearRedo()</code> had been
called).</p>

<p class="XXX">We could fire events when someone adds
something to the undo history -- one event per undo object entry
before the position (or after, during redo addition), allowing the
script to decide if that entry should remain or not. Or
something. Would make it potentially easier to expire server-held
state when the server limitations come into play.</p>

<!-- XXX note on expiring undo in case server can only do one level undo -->

<p>The <dfn title="dom-UndoManager-remove"><code>remove(<var
title="">index</var>)</code></dfn> method must remove the <span>undo
object</span> entry with the specified <var title="">index</var>. If
Expand All @@ -69326,10 +69280,6 @@ interface <dfn>SQLTransactionSync</dfn> {
<span>DOM changes</span> entries or <span>undo object</span>
entries.</p>

<p class="XXX">Another idea is to have a way for scripts to
say "startBatchingDOMChangesForUndo()" and after that the changes to
the DOM go in as if the user had done them.</p>

</div>


Expand Down

0 comments on commit 5afb34a

Please sign in to comment.