Add an example to 2.2.1 suggested by Caio Marcelo de Oliveira Filho
authorRyosuke Niwa <rniwa@webkit.org>
Wed, 04 Jul 2012 15:20:42 -0700
changeset 15 f9b794dcc21f
parent 14 9cae0e0c55cb
child 16 77b8999a67d6
Add an example to 2.2.1 suggested by Caio Marcelo de Oliveira Filho
source.html
undomanager.html
--- a/source.html	Wed Jul 04 15:06:39 2012 -0700
+++ b/source.html	Wed Jul 04 15:20:42 2012 -0700
@@ -151,6 +151,28 @@
     <code><a href="#attr-undoscope">undoscope</a></code> content attribute is removed and added back to all descendent nodes of the element that have become
     non-<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable">editable</a> due to the change.</p>
 
+    <div class="example">
+        <p>In the following example, Because <code><a href="#dom-undomanager-item">item()</a></code> returns new array on each call,
+        modifying the array does not have any effect on the sequence of <a href="#dom-transaction">DOM transactions</a> of the entry,
+        and two return values of <code><a href="#dom-undomanager-item">item()</a></code> are alwys different objects.</p>
+
+        <pre>
+&lt;div id="container"&gt;
+    &lt;div undoscope&gt;This will be editable&lt;/div&gt;
+    &lt;div contenteditable undoscope="false"&gt;This will remain not editable.&lt;/div&gt;
+&lt;/div&gt;
+&lt;script&gt;
+var container = document.getElementById('container');
+var children = container.getElementsByTagName('*');
+children[0].undoManager.transact({executeAutomatic: function () {}});
+children[1].undoManager.transact({executeAutomatic: function () {}});
+container.contentEditable = true;
+alert(children[0].undoManager); // Alerts null
+alert(children[1].undoManager.length); // Alerts 1
+&lt;/script&gt;
+</pre>
+    </div>
+
 <h4>undoScope IDL attribute</h4>
 
     <pre class="idl">partial interface <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614">Element</a> {
--- a/undomanager.html	Wed Jul 04 15:06:39 2012 -0700
+++ b/undomanager.html	Wed Jul 04 15:20:42 2012 -0700
@@ -179,6 +179,27 @@
     <code><a href=#attr-undoscope>undoscope</a></code> content attribute is removed and added back to all descendent nodes of the element that have become
     non-<a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable>editable</a> due to the change.</p>
 
+    <div class=example>
+        <p>In the following example, Because <code><a href=#dom-undomanager-item>item()</a></code> returns new array on each call,
+        modifying the array does not have any effect on the sequence of <a href=#dom-transaction>DOM transactions</a> of the entry,
+        and two return values of <code><a href=#dom-undomanager-item>item()</a></code> are alwys different objects.</p>
+
+        <pre>&lt;div id="container"&gt;
+    &lt;div undoscope&gt;This will be editable&lt;/div&gt;
+    &lt;div contenteditable undoscope="false"&gt;This will remain not editable.&lt;/div&gt;
+&lt;/div&gt;
+&lt;script&gt;
+var container = document.getElementById('container');
+var children = container.getElementsByTagName('*');
+children[0].undoManager.transact({executeAutomatic: function () {}});
+children[1].undoManager.transact({executeAutomatic: function () {}});
+container.contentEditable = true;
+alert(children[0].undoManager); // Alerts null
+alert(children[1].undoManager.length); // Alerts 1
+&lt;/script&gt;
+</pre>
+    </div>
+
 <h4 id=undoscope-idl-attribute><span class=secno>2.2.2 </span>undoScope IDL attribute</h4>
 
     <pre class=idl>partial interface <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614>Element</a> {