Skip to content

Commit

Permalink
[e] (0) Factor out foster parenting to ensure it is not ambiguous.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@1691 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 24, 2008
1 parent 4b4bfb0 commit cbbdf87
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 137 deletions.
186 changes: 94 additions & 92 deletions index
Expand Up @@ -1698,70 +1698,73 @@
<li><a href="#closing"><span class=secno>8.2.5.2. </span>Closing
elements that have implied end tags</a>

<li><a href="#the-initial"><span class=secno>8.2.5.3. </span>The
<li><a href="#foster"><span class=secno>8.2.5.3. </span>Foster
parenting</a>

<li><a href="#the-initial"><span class=secno>8.2.5.4. </span>The
"initial" insertion mode</a>

<li><a href="#the-before"><span class=secno>8.2.5.4. </span>The
<li><a href="#the-before"><span class=secno>8.2.5.5. </span>The
"before html" insertion mode</a>

<li><a href="#the-before0"><span class=secno>8.2.5.5. </span>The
<li><a href="#the-before0"><span class=secno>8.2.5.6. </span>The
"before head" insertion mode</a>

<li><a href="#parsing-main-inhead"><span class=secno>8.2.5.6.
<li><a href="#parsing-main-inhead"><span class=secno>8.2.5.7.
</span>The "in head" insertion mode</a>

<li><a href="#parsing-main-inheadnoscript"><span
class=secno>8.2.5.7. </span>The "in head noscript" insertion
class=secno>8.2.5.8. </span>The "in head noscript" insertion
mode</a>

<li><a href="#the-after"><span class=secno>8.2.5.8. </span>The
<li><a href="#the-after"><span class=secno>8.2.5.9. </span>The
"after head" insertion mode</a>

<li><a href="#parsing-main-inbody"><span class=secno>8.2.5.9.
<li><a href="#parsing-main-inbody"><span class=secno>8.2.5.10.
</span>The "in body" insertion mode</a>

<li><a href="#parsing-main-intable"><span class=secno>8.2.5.10.
<li><a href="#parsing-main-intable"><span class=secno>8.2.5.11.
</span>The "in table" insertion mode</a>

<li><a href="#parsing-main-incaption"><span class=secno>8.2.5.11.
<li><a href="#parsing-main-incaption"><span class=secno>8.2.5.12.
</span>The "in caption" insertion mode</a>

<li><a href="#parsing-main-incolgroup"><span class=secno>8.2.5.12.
<li><a href="#parsing-main-incolgroup"><span class=secno>8.2.5.13.
</span>The "in column group" insertion mode</a>

<li><a href="#parsing-main-intbody"><span class=secno>8.2.5.13.
<li><a href="#parsing-main-intbody"><span class=secno>8.2.5.14.
</span>The "in table body" insertion mode</a>

<li><a href="#parsing-main-intr"><span class=secno>8.2.5.14.
<li><a href="#parsing-main-intr"><span class=secno>8.2.5.15.
</span>The "in row" insertion mode</a>

<li><a href="#parsing-main-intd"><span class=secno>8.2.5.15.
<li><a href="#parsing-main-intd"><span class=secno>8.2.5.16.
</span>The "in cell" insertion mode</a>

<li><a href="#parsing-main-inselect"><span class=secno>8.2.5.16.
<li><a href="#parsing-main-inselect"><span class=secno>8.2.5.17.
</span>The "in select" insertion mode</a>

<li><a href="#parsing-main-inselectintable"><span
class=secno>8.2.5.17. </span>The "in select in table" insertion
class=secno>8.2.5.18. </span>The "in select in table" insertion
mode</a>

<li><a href="#parsing-main-inforeign"><span class=secno>8.2.5.18.
<li><a href="#parsing-main-inforeign"><span class=secno>8.2.5.19.
</span>The "in foreign content" insertion mode</a>

<li><a href="#parsing-main-afterbody"><span class=secno>8.2.5.19.
<li><a href="#parsing-main-afterbody"><span class=secno>8.2.5.20.
</span>The "after body" insertion mode</a>

<li><a href="#parsing-main-inframeset"><span class=secno>8.2.5.20.
<li><a href="#parsing-main-inframeset"><span class=secno>8.2.5.21.
</span>The "in frameset" insertion mode</a>

<li><a href="#parsing-main-afterframeset"><span
class=secno>8.2.5.21. </span>The "after frameset" insertion
class=secno>8.2.5.22. </span>The "after frameset" insertion
mode</a>

<li><a href="#the-after0"><span class=secno>8.2.5.22. </span>The
<li><a href="#the-after0"><span class=secno>8.2.5.23. </span>The
"after after body" insertion mode</a>

<li><a href="#the-after1"><span class=secno>8.2.5.23. </span>The
<li><a href="#the-after1"><span class=secno>8.2.5.24. </span>The
"after after frameset" insertion mode</a>
</ul>

Expand Down Expand Up @@ -44988,7 +44991,48 @@ function receiver(e) {
element to exclude from the process, then the UA must perform the above
steps as if that element was not in the above list.

<h5 id=the-initial><span class=secno>8.2.5.3. </span>The "<dfn id=initial
<h5 id=foster><span class=secno>8.2.5.3. </span>Foster parenting</h5>

<p>Foster parenting happens when content is misnested in tables.

<p>When a node <var title="">node</var> is to be <dfn id=foster0
title="foster parent">foster parented</dfn>, the node <var
title="">node</var> must be inserted into the <i><a href="#foster1">foster
parent element</a></i>, and the <a href="#current6">current table</a> must
be marked as <dfn id=tainted>tainted</dfn>. (Once the <a
href="#current6">current table</a> has been <a
href="#tainted">tainted</a>, whitespace characters are inserted into the
<i><a href="#foster1">foster parent element</a></i> instead of the <a
href="#current5">current node</a>.)

<p>The <dfn id=foster1>foster parent element</dfn> is the parent element of
the last <code><a href="#table">table</a></code> element in the <a
href="#stack">stack of open elements</a>, if there is a <code><a
href="#table">table</a></code> element and it has such a parent element.
If there is no <code><a href="#table">table</a></code> element in the <a
href="#stack">stack of open elements</a> (<a href="#fragment">fragment
case</a>), then the <em><a href="#foster1">foster parent element</a></em>
is the first element in the <a href="#stack">stack of open elements</a>
(the <code><a href="#html">html</a></code> element). Otherwise, if there
is a <code><a href="#table">table</a></code> element in the <a
href="#stack">stack of open elements</a>, but the last <code><a
href="#table">table</a></code> element in the <a href="#stack">stack of
open elements</a> has no parent, or its parent node is not an element,
then the <em><a href="#foster1">foster parent element</a></em> is the
element before the last <code><a href="#table">table</a></code> element in
the <a href="#stack">stack of open elements</a>.

<p>If the <i><a href="#foster1">foster parent element</a></i> is the parent
element of the last <code><a href="#table">table</a></code> element in the
<a href="#stack">stack of open elements</a>, then <var title="">node</var>
must be inserted immediately <em>before</em> the last <code><a
href="#table">table</a></code> element in the <a href="#stack">stack of
open elements</a> in the <i><a href="#foster1">foster parent
element</a></i>; otherwise, <var title="">node</var> must be
<em>appended</em> to the <i><a href="#foster1">foster parent
element</a></i>.

<h5 id=the-initial><span class=secno>8.2.5.4. </span>The "<dfn id=initial
title="insertion mode: initial">initial</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#initial"
Expand Down Expand Up @@ -45294,7 +45338,7 @@ function receiver(e) {
current token.</p>
</dl>

<h5 id=the-before><span class=secno>8.2.5.4. </span>The "<dfn id=before4
<h5 id=the-before><span class=secno>8.2.5.5. </span>The "<dfn id=before4
title="insertion mode: before html">before html</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#before4"
Expand Down Expand Up @@ -45367,7 +45411,7 @@ function receiver(e) {
content continues being appended to the nodes as described in the next
section.

<h5 id=the-before0><span class=secno>8.2.5.5. </span>The "<dfn id=before5
<h5 id=the-before0><span class=secno>8.2.5.6. </span>The "<dfn id=before5
title="insertion mode: before head">before head</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#before5"
Expand Down Expand Up @@ -45437,7 +45481,7 @@ function receiver(e) {
after head">after head</a>" <span>insertion mode</span>.</p>
</dl>

<h5 id=parsing-main-inhead><span class=secno>8.2.5.6. </span>The "<dfn
<h5 id=parsing-main-inhead><span class=secno>8.2.5.7. </span>The "<dfn
id=in-head title="insertion mode: in head">in head</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#in-head"
Expand Down Expand Up @@ -45688,7 +45732,7 @@ function receiver(e) {
get put into the head. Do we want to copy that?</p>
</dl>

<h5 id=parsing-main-inheadnoscript><span class=secno>8.2.5.7. </span>The
<h5 id=parsing-main-inheadnoscript><span class=secno>8.2.5.8. </span>The
"<dfn id=in-head0 title="insertion mode: in head noscript">in head
noscript</dfn>" insertion mode</h5>

Expand Down Expand Up @@ -45753,7 +45797,7 @@ function receiver(e) {
name "noscript" had been seen and reprocess the current token.</p>
</dl>

<h5 id=the-after><span class=secno>8.2.5.8. </span>The "<dfn id=after4
<h5 id=the-after><span class=secno>8.2.5.9. </span>The "<dfn id=after4
title="insertion mode: after head">after head</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#after4"
Expand Down Expand Up @@ -45837,7 +45881,7 @@ function receiver(e) {
had been seen, and then reprocess the current token.</p>
</dl>

<h5 id=parsing-main-inbody><span class=secno>8.2.5.9. </span>The "<dfn
<h5 id=parsing-main-inbody><span class=secno>8.2.5.10. </span>The "<dfn
id=in-body title="insertion mode: in body">in body</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#in-body"
Expand Down Expand Up @@ -46428,18 +46472,8 @@ function receiver(e) {
href="#tbody">tbody</a></code>, <code><a
href="#tfoot0">tfoot</a></code>, <code><a
href="#thead0">thead</a></code>, or <code><a href="#tr">tr</a></code>
element, then, insert whatever <var title="">last node</var> ended up
being in the previous step into the <i><a href="#foster">foster parent
element</a></i>. If the <i><a href="#foster">foster parent
element</a></i> is the parent element of the last <code><a
href="#table">table</a></code> element in the <a href="#stack">stack
of open elements</a>, then <var title="">last node</var> must be
inserted immediately <em>before</em> the last <code><a
href="#table">table</a></code> element in the <a href="#stack">stack
of open elements</a> in the <i><a href="#foster">foster parent
element</a></i>; otherwise, <var title="">last node</var> must be
<em>appended</em> to the <i><a href="#foster">foster parent
element</a></i>.</p>
element, then, <a href="#foster0">foster parent</a> whatever <var
title="">last node</var> ended up being in the previous step.</p>

<p>Otherwise, append whatever <var title="">last node</var> ended up
being in the previous step to the <var title="">common ancestor</var>
Expand Down Expand Up @@ -46903,7 +46937,7 @@ function receiver(e) {
</ol>
</dl>

<h5 id=parsing-main-intable><span class=secno>8.2.5.10. </span>The "<dfn
<h5 id=parsing-main-intable><span class=secno>8.2.5.11. </span>The "<dfn
id=in-table title="insertion mode: in table">in table</dfn>" insertion
mode</h5>

Expand Down Expand Up @@ -47067,46 +47101,14 @@ function receiver(e) {
<p><a href="#parse1">Parse error</a>. Process the token <a
href="#using8">using the rules for</a> the "<a href="#in-body"
title="insertion mode: in body">in body</a>" <span>insertion
mode</span>, with the following exception:</p>

<p>If the <a href="#current5">current node</a> is a <code><a
href="#table">table</a></code>, <code><a href="#tbody">tbody</a></code>,
<code><a href="#tfoot0">tfoot</a></code>, <code><a
mode</span>, except that if the <a href="#current5">current node</a> is
a <code><a href="#table">table</a></code>, <code><a
href="#tbody">tbody</a></code>, <code><a
href="#tfoot0">tfoot</a></code>, <code><a
href="#thead0">thead</a></code>, or <code><a href="#tr">tr</a></code>
element, then, whenever a node would be inserted into the <a
href="#current5">current node</a>, it must instead be inserted into the
<i><a href="#foster">foster parent element</a></i>, and the <a
href="#current6">current table</a> must be marked as <dfn
id=tainted>tainted</dfn>. (Once the <a href="#current6">current
table</a> has been <a href="#tainted">tainted</a>, whitespace characters
are inserted into the <i><a href="#foster">foster parent element</a></i>
instead of the <a href="#current5">current node</a>.)</p>

<p>The <dfn id=foster>foster parent element</dfn> is the parent element
of the last <code><a href="#table">table</a></code> element in the <a
href="#stack">stack of open elements</a>, if there is a <code><a
href="#table">table</a></code> element and it has such a parent element.
If there is no <code><a href="#table">table</a></code> element in the <a
href="#stack">stack of open elements</a> (<a href="#fragment">fragment
case</a>), then the <em><a href="#foster">foster parent element</a></em>
is the first element in the <a href="#stack">stack of open elements</a>
(the <code><a href="#html">html</a></code> element). Otherwise, if there
is a <code><a href="#table">table</a></code> element in the <a
href="#stack">stack of open elements</a>, but the last <code><a
href="#table">table</a></code> element in the <a href="#stack">stack of
open elements</a> has no parent, or its parent node is not an element,
then the <em><a href="#foster">foster parent element</a></em> is the
element before the last <code><a href="#table">table</a></code> element
in the <a href="#stack">stack of open elements</a>.</p>

<p>If the <i><a href="#foster">foster parent element</a></i> is the
parent element of the last <code><a href="#table">table</a></code>
element in the <a href="#stack">stack of open elements</a>, then the new
node must be inserted immediately <em>before</em> the last <code><a
href="#table">table</a></code> element in the <a href="#stack">stack of
open elements</a> in the <i><a href="#foster">foster parent
element</a></i>; otherwise, the new node must be <em>appended</em> to
the <i><a href="#foster">foster parent element</a></i>.</p>
href="#current5">current node</a>, it must instead be <a href="#foster0"
title="foster parent">foster parented</a>.</p>
</dl>

<p>When the steps above require the UA to <dfn id=clear2>clear the stack
Expand All @@ -47120,7 +47122,7 @@ function receiver(e) {
href="#html">html</a></code> element after this process is a <a
href="#fragment">fragment case</a>.

<h5 id=parsing-main-incaption><span class=secno>8.2.5.11. </span>The "<dfn
<h5 id=parsing-main-incaption><span class=secno>8.2.5.12. </span>The "<dfn
id=in-caption title="insertion mode: in caption">in caption</dfn>"
insertion mode</h5>

Expand Down Expand Up @@ -47183,7 +47185,7 @@ function receiver(e) {
<span>insertion mode</span>.</p>
</dl>

<h5 id=parsing-main-incolgroup><span class=secno>8.2.5.12. </span>The "<dfn
<h5 id=parsing-main-incolgroup><span class=secno>8.2.5.13. </span>The "<dfn
id=in-column title="insertion mode: in column group">in column
group</dfn>" insertion mode</h5>

Expand Down Expand Up @@ -47268,7 +47270,7 @@ function receiver(e) {
href="#fragment">fragment case</a>.</p>
</dl>

<h5 id=parsing-main-intbody><span class=secno>8.2.5.13. </span>The "<dfn
<h5 id=parsing-main-intbody><span class=secno>8.2.5.14. </span>The "<dfn
id=in-table0 title="insertion mode: in table body">in table body</dfn>"
insertion mode</h5>

Expand Down Expand Up @@ -47358,7 +47360,7 @@ function receiver(e) {
href="#html">html</a></code> element after this process is a <a
href="#fragment">fragment case</a>.

<h5 id=parsing-main-intr><span class=secno>8.2.5.14. </span>The "<dfn
<h5 id=parsing-main-intr><span class=secno>8.2.5.15. </span>The "<dfn
id=in-row title="insertion mode: in row">in row</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#in-row"
Expand Down Expand Up @@ -47447,7 +47449,7 @@ function receiver(e) {
href="#html">html</a></code> element after this process is a <a
href="#fragment">fragment case</a>.

<h5 id=parsing-main-intd><span class=secno>8.2.5.15. </span>The "<dfn
<h5 id=parsing-main-intd><span class=secno>8.2.5.16. </span>The "<dfn
id=in-cell title="insertion mode: in cell">in cell</dfn>" insertion mode</h5>

<p>When the <span>insertion mode</span> is "<a href="#in-cell"
Expand Down Expand Up @@ -47548,7 +47550,7 @@ function receiver(e) {
neither when the <span>insertion mode</span> is "<a href="#in-cell"
title="insertion mode: in cell">in cell</a>".

<h5 id=parsing-main-inselect><span class=secno>8.2.5.16. </span>The "<dfn
<h5 id=parsing-main-inselect><span class=secno>8.2.5.17. </span>The "<dfn
id=in-select title="insertion mode: in select">in select</dfn>" insertion
mode</h5>

Expand Down Expand Up @@ -47670,7 +47672,7 @@ function receiver(e) {
<p><a href="#parse1">Parse error</a>. Ignore the token.</p>
</dl>

<h5 id=parsing-main-inselectintable><span class=secno>8.2.5.17. </span>The
<h5 id=parsing-main-inselectintable><span class=secno>8.2.5.18. </span>The
"<dfn id=in-select0 title="insertion mode: in select in table">in select
in table</dfn>" insertion mode</h5>

Expand Down Expand Up @@ -47706,7 +47708,7 @@ function receiver(e) {
<span>insertion mode</span>.</p>
</dl>

<h5 id=parsing-main-inforeign><span class=secno>8.2.5.18. </span>The "<dfn
<h5 id=parsing-main-inforeign><span class=secno>8.2.5.19. </span>The "<dfn
id=in-foreign title="insertion mode: in foreign content">in foreign
content</dfn>" insertion mode</h5>

Expand Down Expand Up @@ -47868,7 +47870,7 @@ function receiver(e) {
flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
</dl>

<h5 id=parsing-main-afterbody><span class=secno>8.2.5.19. </span>The "<dfn
<h5 id=parsing-main-afterbody><span class=secno>8.2.5.20. </span>The "<dfn
id=after5 title="insertion mode: after body">after body</dfn>" insertion
mode</h5>

Expand Down Expand Up @@ -47932,7 +47934,7 @@ function receiver(e) {
body</a>" and reprocess the token.</p>
</dl>

<h5 id=parsing-main-inframeset><span class=secno>8.2.5.20. </span>The "<dfn
<h5 id=parsing-main-inframeset><span class=secno>8.2.5.21. </span>The "<dfn
id=in-frameset title="insertion mode: in frameset">in frameset</dfn>"
insertion mode</h5>

Expand Down Expand Up @@ -48027,7 +48029,7 @@ function receiver(e) {
<p><a href="#parse1">Parse error</a>. Ignore the token.</p>
</dl>

<h5 id=parsing-main-afterframeset><span class=secno>8.2.5.21. </span>The
<h5 id=parsing-main-afterframeset><span class=secno>8.2.5.22. </span>The
"<dfn id=after6 title="insertion mode: after frameset">after
frameset</dfn>" insertion mode</h5>

Expand Down Expand Up @@ -48087,7 +48089,7 @@ function receiver(e) {
that do support frames but want to show the NOFRAMES content. Supporting
the former is easy; supporting the latter is harder.

<h5 id=the-after0><span class=secno>8.2.5.22. </span>The "<dfn id=after7
<h5 id=the-after0><span class=secno>8.2.5.23. </span>The "<dfn id=after7
title="insertion mode: after after body">after after body</dfn>" insertion
mode</h5>

Expand Down Expand Up @@ -48129,7 +48131,7 @@ function receiver(e) {
body</a>" and reprocess the token.</p>
</dl>

<h5 id=the-after1><span class=secno>8.2.5.23. </span>The "<dfn id=after8
<h5 id=the-after1><span class=secno>8.2.5.24. </span>The "<dfn id=after8
title="insertion mode: after after frameset">after after frameset</dfn>"
insertion mode</h5>

Expand Down

0 comments on commit cbbdf87

Please sign in to comment.