- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 29 Apr 2009 21:53:40 +0000
- To: public-html-commits@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<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
Received on Wednesday, 29 April 2009 21:53:49 UTC