[html5] r3028 - [e] (0) Add some examples of processing of text nodes in HTML5.

whatwg at whatwg.org whatwg at whatwg.org
Wed Apr 29 14:53:33 PDT 2009


Author: ianh
Date: 2009-04-29 14:53:32 -0700 (Wed, 29 Apr 2009)
New Revision: 3028

Modified:
   index
   source
Log:
[e] (0) Add some examples of processing of text nodes in HTML5.

Modified: index
===================================================================
--- index	2009-04-29 19:14:17 UTC (rev 3027)
+++ index	2009-04-29 21:53:32 UTC (rev 3028)
@@ -55158,6 +55158,35 @@
   <code>Text</code> node whose data is just that character must be
   inserted in the appropriate place.</p>
 
+  <div class=example>
+
+   <p>Here are some sample inputs to the parser and the corresponding
+   number of text nodes that they result in, assuming a user agent
+   that executes scripts.</p>
+
+   <table><thead><tr><th>Input <th>Number of text nodes
+    <tbody><tr><td><pre>A<script>
+var script = document.getElementsByTagName('script')[0];
+document.body.removeChild(script);
+</script>B</pre>
+      <td>Two adjacent text nodes in the document, containing "A" and "B".
+     <tr><td><pre>A<script>
+var text = document.createTextNode('B');
+document.body.appendChild(text);
+</script>C</pre>
+      <td>Four text nodes; "A" before the script, the script's contents, "B" after the script, and then, immediately after that, "C".
+     <tr><td><pre>A<script>
+var text = document.getElementsByTagName('script')[0].firstChild;
+text.data = 'B';
+document.body.appendChild(text);
+</script>B</pre>
+      <td>Two adjacent text nodes in the document, containing "A" and "BB".
+     <tr><td><pre>A<table>B<tr>C</tr>C</table></pre>
+      <td>Three adjacent text nodes before the table, containing "A", "B", and "CC" respectively. (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a>.)
+     <tr><td><pre>A<table><tr> B</tr> B</table></pre>
+      <td>Two adjacent text nodes before the table, containing "A" and "B B" respectively, and one text node inside the table with a single space character. (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a> and <a href=#tainted title=tainted>tainting</a>.)
+   </table></div>
+
   <p id=mutation-during-parsing>DOM mutation events must not fire
   for changes caused by the UA parsing the document. (Conceptually,
   the parser is not mutating the DOM, it is constructing it.) This

Modified: source
===================================================================
--- source	2009-04-29 19:14:17 UTC (rev 3027)
+++ source	2009-04-29 21:53:32 UTC (rev 3028)
@@ -67659,6 +67659,46 @@
   <code>Text</code> node whose data is just that character must be
   inserted in the appropriate place.</p>
 
+  <div class="example">
+
+   <p>Here are some sample inputs to the parser and the corresponding
+   number of text nodes that they result in, assuming a user agent
+   that executes scripts.</p>
+
+   <table>
+    <thead>
+     <tr>
+      <th>Input <th>Number of text nodes
+    <tbody>
+     <tr>
+      <td><pre>A<script>
+var script = document.getElementsByTagName('script')[0];
+document.body.removeChild(script);
+</script>B</pre>
+      <td>Two adjacent text nodes in the document, containing "A" and "B".
+     <tr>
+      <td><pre>A<script>
+var text = document.createTextNode('B');
+document.body.appendChild(text);
+</script>C</pre>
+      <td>Four text nodes; "A" before the script, the script's contents, "B" after the script, and then, immediately after that, "C".
+     <tr>
+      <td><pre>A<script>
+var text = document.getElementsByTagName('script')[0].firstChild;
+text.data = 'B';
+document.body.appendChild(text);
+</script>B</pre>
+      <td>Two adjacent text nodes in the document, containing "A" and "BB".
+     <tr>
+      <td><pre>A<table>B<tr>C</tr>C</table></pre>
+      <td>Three adjacent text nodes before the table, containing "A", "B", and "CC" respectively. (This is caused by <span title="foster parent">foster parenting</span>.)
+     <tr>
+      <td><pre>A<table><tr> B</tr> B</table></pre>
+      <td>Two adjacent text nodes before the table, containing "A" and "B B" respectively, and one text node inside the table with a single space character. (This is caused by <span title="foster parent">foster parenting</span> and <span title="tainted">tainting</span>.)
+   </table>
+
+  </div>
+
   <p id="mutation-during-parsing">DOM mutation events must not fire
   for changes caused by the UA parsing the document. (Conceptually,
   the parser is not mutating the DOM, it is constructing it.) This




More information about the Commit-Watchers mailing list