Skip to content

Commit

Permalink
[cgiowt] (2) Change the 'reset the insertion mode appropriately' algo…
Browse files Browse the repository at this point in the history
…rithm to handle tables in foreign content inside tables.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=7992

git-svn-id: http://svn.whatwg.org/webapps@4290 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 23, 2009
1 parent 3cfbd7f commit d7286e5
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 132 deletions.
93 changes: 49 additions & 44 deletions complete.html
Expand Up @@ -70349,93 +70349,98 @@ <h5 id=the-insertion-mode><span class=secno>11.2.3.1 </span>The insertion mode</

<ol><li>Let <var title="">last</var> be false.</li>

<li>Let <var title="">foreign</var> be false.</li>

<li>Let <var title="">node</var> be the last node in the
<a href=#stack-of-open-elements>stack of open elements</a>.</li>

<li>If <var title="">node</var> is the first node in the stack of
open elements, then set <var title="">last</var> to true and set
<var title="">node</var> to the <var title="">context</var>
element. (<a href=#fragment-case>fragment case</a>)</li>
<li><i>Loop</i>: If <var title="">node</var> is the first node in
the stack of open elements, then set <var title="">last</var> to
true and set <var title="">node</var> to the <var title="">context</var> element. (<a href=#fragment-case>fragment case</a>)</li>

<li>If <var title="">node</var> is a <code><a href=#the-select-element>select</a></code> element,
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>" and abort these
steps. (<a href=#fragment-case>fragment case</a>)</li>
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>" and jump to the
step marked <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li>

<li>If <var title="">node</var> is a <code><a href=#the-td-element>td</a></code> or
<code><a href=#the-th-element>th</a></code> element and <var title="">last</var> is false, then
switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intd title="insertion
mode: in cell">in cell</a>" and abort these steps.</li>
mode: in cell">in cell</a>" and jump to the step marked <i title="">end</i>.</li>

<li>If <var title="">node</var> is a <code><a href=#the-tr-element>tr</a></code> element, then
switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intr title="insertion
mode: in row">in row</a>" and abort these steps.</li>
mode: in row">in row</a>" and jump to the step marked <i title="">end</i>.</li>

<li>If <var title="">node</var> is a <code><a href=#the-tbody-element>tbody</a></code>,
<code><a href=#the-thead-element>thead</a></code>, or <code><a href=#the-tfoot-element>tfoot</a></code> element, then switch the
<a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intbody title="insertion mode: in
table body">in table body</a>" and abort these steps.</li>
table body">in table body</a>" and jump to the step marked <i title="">end</i>.</li>

<li>If <var title="">node</var> is a <code><a href=#the-caption-element>caption</a></code> element,
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>" and abort
these steps.</li>
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incaption title="insertion mode: in caption">in caption</a>" and jump to
the step marked <i title="">end</i>.</li>

<li>If <var title="">node</var> is a <code><a href=#the-colgroup-element>colgroup</a></code> element,
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-incolgroup title="insertion mode: in column group">in column group</a>" and
abort these steps. (<a href=#fragment-case>fragment case</a>)</li>
jump to the step marked <i title="">end</i>. (<a href=#fragment-case>fragment
case</a>)</li>

<li>If <var title="">node</var> is a <code><a href=#the-table-element>table</a></code> element,
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" and abort these
steps.</li>

<li>If <var title="">node</var> is an element from the <a href=#mathml-namespace>MathML
namespace</a> or the <a href=#svg-namespace>SVG namespace</a>, then switch the
<a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inforeign title="insertion mode: in
foreign content">in foreign content</a>", let the
<a href=#secondary-insertion-mode>secondary insertion mode</a> be "<a href=#parsing-main-inbody title="insertion
mode: in body">in body</a>", and abort these steps.</li>
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-intable title="insertion mode: in table">in table</a>" and jump to the
step marked <i title="">end</i>.</li>

<li>If <var title="">node</var> is a <code><a href=#the-head-element-0>head</a></code> element,
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" ("<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>"! <em> not "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>"</em>!) and abort
these steps. (<a href=#fragment-case>fragment case</a>)</li> <!-- This is only
here for now in case people think that the spec accidentally
omitted it and try to "fix" it. Note that noscript-in-head is also
handled this way. This is all intentional. The only thing it
doesn't handle is the scripting-disabled fragment parsing case for
a <head> element containing a <noscript> which itself contains
something other than a <link> or a <style> element; you'd expect
that to break out of the <noscript> but it doesn't. This is an edge
case that doesn't affect the spec, since the algorithm for fragment
parsing is only used for innerHTML/outerHTML/insertAdjacentHTML(),
where we know scripting is enabled. -->
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" ("<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>"! <em> not "<a href=#parsing-main-inhead title="insertion mode: in head">in head</a>"</em>!) and jump to
the step marked <i title="">end</i>. (<a href=#fragment-case>fragment
case</a>)</li> <!-- This is only here for now in case people
think that the spec accidentally omitted it and try to "fix"
it. Note that noscript-in-head is also handled this way. This is
all intentional. The only thing it doesn't handle is the
scripting-disabled fragment parsing case for a <head> element
containing a <noscript> which itself contains something other than
a <link> or a <style> element; you'd expect that to break out of
the <noscript> but it doesn't. This is an edge case that doesn't
affect the spec, since the algorithm for fragment parsing is only
used for innerHTML/outerHTML/insertAdjacentHTML(), where we know
scripting is enabled. -->

<li>If <var title="">node</var> is a <code><a href=#the-body-element-0>body</a></code> element,
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" and abort these
steps.</li>
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>" and jump to the
step marked <i title="">end</i>.</li>

<li>If <var title="">node</var> is a <code><a href=#frameset>frameset</a></code> element,
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>" and abort
these steps. (<a href=#fragment-case>fragment case</a>)</li>
then switch the <a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inframeset title="insertion mode: in frameset">in frameset</a>" and jump to
the step marked <i title="">end</i>. (<a href=#fragment-case>fragment
case</a>)</li>

<li>If <var title="">node</var> is an <code><a href=#the-html-element-0>html</a></code> element,
then <!--: if the <span><code title="">head</code> element
pointer</span> is null,--> switch the <a href=#insertion-mode>insertion mode</a>
to "<a href=#the-before-head-insertion-mode title="insertion mode: before head">before
head</a>"<!--, otherwise, switch the <span>insertion mode</span>
to "<span title="insertion mode: after head">after head</span>".-->
Then, <!-- in either case, --> abort these steps. (<a href=#fragment-case>fragment
case</a>)</li> <!-- if the head element pointer can ever be
non-null when we're going through these steps, we'll need to
uncomment out the commented-out bits -->
Then, <!-- in either case, --> jump to the step marked <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li> <!-- if the
head element pointer can ever be non-null when we're going through
these steps, we'll need to uncomment out the commented-out bits -->

<li>If <var title="">node</var> is an element from the <a href=#mathml-namespace>MathML
namespace</a> or the <a href=#svg-namespace>SVG namespace</a>, then set the
<var title="">foreign</var> flag to true.</li>

<li>If <var title="">last</var> is true, then switch the
<a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inbody title="insertion mode: in
body">in body</a>" and abort these steps. (<a href=#fragment-case>fragment
case</a>)</li>
body">in body</a>" and jump to the step marked <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li>

<li>Let <var title="">node</var> now be the node before <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
elements</a>.</li>

<li>Return to step 3.</li>
<li>Return to the step marked <i>loop</i>.</li>

<li><i>End</i>: If <var title="">foreign</var> is true, switch the
<a href=#secondary-insertion-mode>secondary insertion mode</a> to whatever the
<a href=#insertion-mode>insertion mode</a> is set to, and switch the
<a href=#insertion-mode>insertion mode</a> to "<a href=#parsing-main-inforeign title="insertion mode: in
foreign content">in foreign content</a>".</li>

</ol><h5 id=the-stack-of-open-elements><span class=secno>11.2.3.2 </span>The stack of open elements</h5>

Expand Down

0 comments on commit d7286e5

Please sign in to comment.