W3C home > Mailing lists > Public > public-html-commits@w3.org > April 2009

html5/spec Overview.html,1.2188,1.2189

From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 29 Apr 2009 21:53:40 +0000
To: public-html-commits@w3.org
Message-Id: <E1LzHim-0004vI-PX@lionel-hutz.w3.org>
Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv18910

Modified Files:
	Overview.html 
Log Message:
Add some examples of processing of text nodes in HTML5. (whatwg r3028)

Index: Overview.html
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2188
retrieving revision 1.2189
diff -u -d -r1.2188 -r1.2189
--- Overview.html	29 Apr 2009 19:14:25 -0000	1.2188
+++ Overview.html	29 Apr 2009 21:53:37 -0000	1.2189
@@ -49438,6 +49438,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&lt;script&gt;
+var&nbsp;script&nbsp;=&nbsp;document.getElementsByTagName('script')[0];
+document.body.removeChild(script);
+&lt;/script&gt;B</pre>
+      <td>Two adjacent text nodes in the document, containing "A" and "B".
+     <tr><td><pre>A&lt;script&gt;
+var&nbsp;text&nbsp;=&nbsp;document.createTextNode('B');
+document.body.appendChild(text);
+&lt;/script&gt;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&lt;script&gt;
+var&nbsp;text&nbsp;=&nbsp;document.getElementsByTagName('script')[0].firstChild;
+text.data&nbsp;=&nbsp;'B';
+document.body.appendChild(text);
+&lt;/script&gt;B</pre>
+      <td>Two adjacent text nodes in the document, containing "A" and "BB".
+     <tr><td><pre>A&lt;table&gt;B&lt;tr&gt;C&lt;/tr&gt;C&lt;/table&gt;</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&lt;table&gt;&lt;tr&gt;&nbsp;B&lt;/tr&gt;&nbsp;B&lt;/table&gt;</pre>
+      <td>Two adjacent text nodes before the table, containing "A" and "B&nbsp;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
Received on Wednesday, 29 April 2009 21:53:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 29 April 2009 21:53:54 GMT