Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giowt] (2) Coalesce text nodes even if they're not parser-inserted.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10221

git-svn-id: http://svn.whatwg.org/webapps@5298 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 16, 2010
1 parent 24dcad5 commit 5708c00
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 42 deletions.
27 changes: 13 additions & 14 deletions complete.html
Expand Up @@ -81594,11 +81594,10 @@ <h4 id=tree-construction><span class=secno>12.2.5 </span><dfn>Tree construction<
<p>When the steps below require the UA to <dfn id=insert-a-character>insert a
character</dfn> into a node, if that node has a child immediately
before where the character is to be inserted, and that child is a
<code><a href=#text>Text</a></code> node, and that <code><a href=#text>Text</a></code> node was the last
node that the parser inserted into the document, then the character
must be appended to that <code><a href=#text>Text</a></code> node; otherwise, a new
<code><a href=#text>Text</a></code> node whose data is just that character must be
inserted in the appropriate place.</p>
<code><a href=#text>Text</a></code> node, then the character must be appended to that
<code><a href=#text>Text</a></code> node; otherwise, a new <code><a href=#text>Text</a></code> node
whose data is just that character must be inserted in the
appropriate place.</p>

<div class=example>

Expand All @@ -81611,24 +81610,24 @@ <h4 id=tree-construction><span class=secno>12.2.5 </span><dfn>Tree construction<
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".
<td>One text node in the document, containing "AB".
<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".
<td>Three text nodes; "A" before the script, the script's contents, and "BC" after the script (the parser appends to the text node created by the script).
<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 "&nbsp;B&nbsp;B" (space-B-space-B) respectively. (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a>.)
&lt;/script&gt;C</pre>
<td>Two adjacent text nodes in the document, containing "A" and "BC".
<tr><td><pre>A&lt;table&gt;B&lt;tr&gt;C&lt;/tr&gt;D&lt;/table&gt;</pre>
<td>One text node before the table, containing "ABCD". (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;C&lt;/table&gt;</pre>
<td>One text node before the table, containing "A&nbsp;B&nbsp;C" (A-space-B-space-C). (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;&lt;/em&gt;C&lt;/table&gt;</pre>
<td>Three adjacent text nodes before the table, containing "A", "&nbsp;B" (space-B), and "C" respectively, and one text node inside the table (as a child of a <code><a href=#the-tbody-element>tbody</a></code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <a href=#foster-parent title="foster parent">foster parenting</a>, even if those other tokens then get ignored.)
<td>One text node before the table, containing "A&nbsp;BC" (A-space-B-C), and one text node inside the table (as a child of a <code><a href=#the-tbody-element>tbody</a></code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <a href=#foster-parent title="foster parent">foster parenting</a>, even if those other tokens then get ignored.)
</table></div>

<p id=mutation-during-parsing>DOM mutation events must not fire
Expand Down
27 changes: 13 additions & 14 deletions index
Expand Up @@ -74696,11 +74696,10 @@ interface <dfn id=messageport>MessagePort</dfn> {
<p>When the steps below require the UA to <dfn id=insert-a-character>insert a
character</dfn> into a node, if that node has a child immediately
before where the character is to be inserted, and that child is a
<code><a href=#text>Text</a></code> node, and that <code><a href=#text>Text</a></code> node was the last
node that the parser inserted into the document, then the character
must be appended to that <code><a href=#text>Text</a></code> node; otherwise, a new
<code><a href=#text>Text</a></code> node whose data is just that character must be
inserted in the appropriate place.</p>
<code><a href=#text>Text</a></code> node, then the character must be appended to that
<code><a href=#text>Text</a></code> node; otherwise, a new <code><a href=#text>Text</a></code> node
whose data is just that character must be inserted in the
appropriate place.</p>

<div class=example>

Expand All @@ -74713,24 +74712,24 @@ interface <dfn id=messageport>MessagePort</dfn> {
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".
<td>One text node in the document, containing "AB".
<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".
<td>Three text nodes; "A" before the script, the script's contents, and "BC" after the script (the parser appends to the text node created by the script).
<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 "&nbsp;B&nbsp;B" (space-B-space-B) respectively. (This is caused by <a href=#foster-parent title="foster parent">foster parenting</a>.)
&lt;/script&gt;C</pre>
<td>Two adjacent text nodes in the document, containing "A" and "BC".
<tr><td><pre>A&lt;table&gt;B&lt;tr&gt;C&lt;/tr&gt;D&lt;/table&gt;</pre>
<td>One text node before the table, containing "ABCD". (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;C&lt;/table&gt;</pre>
<td>One text node before the table, containing "A&nbsp;B&nbsp;C" (A-space-B-space-C). (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;&lt;/em&gt;C&lt;/table&gt;</pre>
<td>Three adjacent text nodes before the table, containing "A", "&nbsp;B" (space-B), and "C" respectively, and one text node inside the table (as a child of a <code><a href=#the-tbody-element>tbody</a></code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <a href=#foster-parent title="foster parent">foster parenting</a>, even if those other tokens then get ignored.)
<td>One text node before the table, containing "A&nbsp;BC" (A-space-B-C), and one text node inside the table (as a child of a <code><a href=#the-tbody-element>tbody</a></code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <a href=#foster-parent title="foster parent">foster parenting</a>, even if those other tokens then get ignored.)
</table></div>

<p id=mutation-during-parsing>DOM mutation events must not fire
Expand Down
27 changes: 13 additions & 14 deletions source
Expand Up @@ -93195,11 +93195,10 @@ interface <dfn>SQLTransactionSync</dfn> {
<p>When the steps below require the UA to <dfn>insert a
character</dfn> into a node, if that node has a child immediately
before where the character is to be inserted, and that child is a
<code>Text</code> node, and that <code>Text</code> node was the last
node that the parser inserted into the document, then the character
must be appended to that <code>Text</code> node; otherwise, a new
<code>Text</code> node whose data is just that character must be
inserted in the appropriate place.</p>
<code>Text</code> node, then the character must be appended to that
<code>Text</code> node; otherwise, a new <code>Text</code> node
whose data is just that character must be inserted in the
appropriate place.</p>

<div class="example">

Expand All @@ -93217,29 +93216,29 @@ interface <dfn>SQLTransactionSync</dfn> {
var&nbsp;script&nbsp;=&nbsp;document.getElementsByTagName('script')[0];
document.body.removeChild(script);
&lt;/script>B</pre>
<td>Two adjacent text nodes in the document, containing "A" and "B".
<td>One text node in the document, containing "AB".
<tr>
<td><pre>A&lt;script>
var&nbsp;text&nbsp;=&nbsp;document.createTextNode('B');
document.body.appendChild(text);
&lt;/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".
<td>Three text nodes; "A" before the script, the script's contents, and "BC" after the script (the parser appends to the text node created by the script).
<tr>
<td><pre>A&lt;script>
var&nbsp;text&nbsp;=&nbsp;document.getElementsByTagName('script')[0].firstChild;
text.data&nbsp;=&nbsp;'B';
document.body.appendChild(text);
&lt;/script>B</pre>
<td>Two adjacent text nodes in the document, containing "A" and "BB".
&lt;/script>C</pre>
<td>Two adjacent text nodes in the document, containing "A" and "BC".
<tr>
<td><pre>A&lt;table>B&lt;tr>C&lt;/tr>C&lt;/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>.)
<td><pre>A&lt;table>B&lt;tr>C&lt;/tr>D&lt;/table></pre>
<td>One text node before the table, containing "ABCD". (This is caused by <span title="foster parent">foster parenting</span>.)
<tr>
<td><pre>A&lt;table>&lt;tr>&nbsp;B&lt;/tr>&nbsp;B&lt;/table></pre>
<td>Two adjacent text nodes before the table, containing "A" and "&nbsp;B&nbsp;B" (space-B-space-B) respectively. (This is caused by <span title="foster parent">foster parenting</span>.)
<td><pre>A&lt;table>&lt;tr>&nbsp;B&lt;/tr>&nbsp;C&lt;/table></pre>
<td>One text node before the table, containing "A&nbsp;B&nbsp;C" (A-space-B-space-C). (This is caused by <span title="foster parent">foster parenting</span>.)
<tr>
<td><pre>A&lt;table>&lt;tr>&nbsp;B&lt;/tr>&nbsp;&lt;/em>C&lt;/table></pre>
<td>Three adjacent text nodes before the table, containing "A", "&nbsp;B" (space-B), and "C" respectively, and one text node inside the table (as a child of a <code>tbody</code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <span title="foster parent">foster parenting</span>, even if those other tokens then get ignored.)
<td>One text node before the table, containing "A&nbsp;BC" (A-space-B-C), and one text node inside the table (as a child of a <code>tbody</code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <span title="foster parent">foster parenting</span>, even if those other tokens then get ignored.)
</table>

</div>
Expand Down

0 comments on commit 5708c00

Please sign in to comment.