[html5] r5521 - [giow] (1) Parser foreign lands: Get rid of secondary insertion mode, always use [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Sep 27 16:45:14 PDT 2010


Author: ianh
Date: 2010-09-27 16:45:12 -0700 (Mon, 27 Sep 2010)
New Revision: 5521

Modified:
   complete.html
   index
   source
Log:
[giow] (1) Parser foreign lands: Get rid of secondary insertion mode, always use 'in body', scope HTML in foreign lands so that we won't try to close elements cross-namespace (e.g. <svg><p><desc><form> won't imply a </p> that closes the <p>...; <td> won't close all the SVG if the SVG is in a cell).
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10314

Modified: complete.html
===================================================================
--- complete.html	2010-09-26 21:03:32 UTC (rev 5520)
+++ complete.html	2010-09-27 23:45:12 UTC (rev 5521)
@@ -211,7 +211,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1>Web Applications 1.0</h1>
-    <h2 class="no-num no-toc">Draft Standard — 26 September 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 27 September 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -77138,20 +77138,18 @@
   how tokens are processed and whether CDATA sections are
   supported.</p>
 
-  <p>Seven of these modes, namely "<a href=#parsing-main-inhead title="insertion mode: in
+  <p>Several of these modes, namely "<a href=#parsing-main-inhead title="insertion mode: in
   head">in head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in
   body</a>", "<a href=#parsing-main-intable title="insertion mode: in table">in
-  table</a>", "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
-  body</a>", "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>",
-  "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>", and "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>", are special, in
-  that the other modes defer to them at various times. When the
-  algorithm below says that the user agent is to do something
-  "<dfn id=using-the-rules-for>using the rules for</dfn> the <var title="">m</var> insertion
-  mode", where <var title="">m</var> is one of these modes, the user
-  agent must use the rules described under the <var title="">m</var>
-  <a href=#insertion-mode>insertion mode</a>'s section, but must leave the
-  <a href=#insertion-mode>insertion mode</a> unchanged unless the rules in <var title="">m</var> themselves switch the <a href=#insertion-mode>insertion mode</a>
-  to a new value.</p>
+  table</a>", and "<a href=#parsing-main-inselect title="insertion mode: in select">in
+  select</a>", are special, in that the other modes defer to them
+  at various times. When the algorithm below says that the user agent
+  is to do something "<dfn id=using-the-rules-for>using the rules for</dfn> the <var title="">m</var> insertion mode", where <var title="">m</var> is one
+  of these modes, the user agent must use the rules described under
+  the <var title="">m</var> <a href=#insertion-mode>insertion mode</a>'s section, but
+  must leave the <a href=#insertion-mode>insertion mode</a> unchanged unless the
+  rules in <var title="">m</var> themselves switch the <a href=#insertion-mode>insertion
+  mode</a> to a new value.</p>
 
   <p>When the insertion mode is switched to "<a href=#parsing-main-incdata title="insertion
   mode: text">text</a>" or "<a href=#parsing-main-intabletext title="insertion mode: in table
@@ -77159,21 +77157,12 @@
   is also set. This is the insertion mode to which the tree
   construction stage will return.</p>
 
-  <p>When the insertion mode is switched to "<a href=#parsing-main-inforeign title="insertion
-  mode: in foreign content">in foreign content</a>", the
-  <dfn id=secondary-insertion-mode>secondary insertion mode</dfn> is also set. This secondary mode
-  is used within the rules for the "<a href=#parsing-main-inforeign title="insertion mode: in
-  foreign content">in foreign content</a>" mode to handle HTML
-  (i.e. not foreign) content.</p>
-
   <hr><p>When the steps below require the UA to <dfn id=reset-the-insertion-mode-appropriately>reset the insertion
   mode appropriately</dfn>, it means the UA must follow these
   steps:</p>
 
   <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>
 
@@ -77182,59 +77171,56 @@
    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 jump to the
-   step labeled <i title="">end</i>. (<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 abort these
+   steps. (<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 jump to the step labeled <i title="">end</i>.</li>
+   mode: in cell">in cell</a>" and abort these steps.</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 jump to the step labeled <i title="">end</i>.</li>
+   mode: in row">in row</a>" and abort these steps.</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 jump to the step labeled <i title="">end</i>.</li>
+   table body">in table body</a>" and abort these steps.</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 jump to
-   the step labeled <i title="">end</i>.</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 abort
+   these steps.</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
-   jump to the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment
-   case</a>)</li>
+   abort these steps. (<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 jump to the
-   step labeled <i title="">end</i>.</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 abort these
+   steps.</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 jump to
-   the step labeled <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. -->
+   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. -->
 
    <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 jump to the
-   step labeled <i title="">end</i>.</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 abort these
+   steps.</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 jump to
-   the step labeled <i title="">end</i>. (<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 abort
+   these steps. (<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
@@ -77242,28 +77228,27 @@
    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, --> jump to the step labeled <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 -->
+   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 -->
 
    <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 <var title="">foreign</var> to true.</li>
+   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>" and abort these
+   steps.</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 jump to the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li>
+   body">in body</a>" and abort these steps. (<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 the step labeled <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>12.2.3.2 </span>The stack of open elements</h5>
 
   <p>Initially, the <dfn id=stack-of-open-elements>stack of open elements</dfn> is empty. The
@@ -77379,8 +77364,15 @@
    <li><code><a href=#the-th-element>th</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
    <li><code><a href=#the-marquee-element>marquee</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
    <li><code><a href=#the-object-element>object</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
+   <li><code title="">mi</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">mo</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">mn</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">ms</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">mtext</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
    <li><code title="">annotation-xml</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
    <li><code title="">foreignObject</code> in the <a href=#svg-namespace>SVG namespace</a></li>
+   <li><code title="">desc</code> in the <a href=#svg-namespace>SVG namespace</a></li>
+   <li><code title="">title</code> in the <a href=#svg-namespace>SVG namespace</a></li>
   </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-list-item-scope title="has an element in list item scope">have an element in list
   item scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
   scope</a> consisting of the following element types:</p>
@@ -77402,6 +77394,13 @@
 
   <ul class=brief><li><code><a href=#the-html-element-0>html</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li> <!-- (This can only happen if the <var title="">node</var> is the topmost node of the <span>stack of open elements</span>, and prevents the next step from being invoked if there are no more elements in the stack.) -->
    <li><code><a href=#the-table-element>table</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
+  </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-select-scope title="has an element in select scope">have an element in select
+  scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
+  scope</a> consisting of all element types <em>except</em> the
+  following:</p>
+
+  <ul class=brief><!--<li><code>select</code> in the <span>HTML namespace</span></li>--><li><code><a href=#the-optgroup-element>optgroup</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
+   <li><code><a href=#the-option-element>option</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   </ul><p>Nothing happens if at any time any of the elements in the
   <a href=#stack-of-open-elements>stack of open elements</a> are moved to a new location in,
   or removed from, the <code><a href=#document>Document</a></code> tree. In particular, the
@@ -81652,10 +81651,8 @@
 
     <p>Otherwise, if the <a href=#insertion-mode>insertion mode</a> is not already
     "<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
-    the current <a href=#insertion-mode>insertion mode</a>, and 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>".</p>
+    content</a>", 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>".</p>
 
    </dd>
 
@@ -81688,10 +81685,8 @@
 
     <p>Otherwise, if the <a href=#insertion-mode>insertion mode</a> is not already
     "<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
-    the current <a href=#insertion-mode>insertion mode</a>, and 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>".</p>
+    content</a>", 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>".</p>
 
    </dd>
 
@@ -82646,7 +82641,7 @@
    <dt>An end tag whose tag name is "select"</dt>
    <dd>
 
-    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-select-scope title="has an element in select scope">have an element in select
     scope</a> with the same tag name as the token, this is a
     <a href=#parse-error>parse error</a>. Ignore the token. (<a href=#fragment-case>fragment
     case</a>)</p>
@@ -82674,8 +82669,8 @@
 
     <p><a href=#parse-error>Parse error</a>.</p>
 
-    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>select</code>
-    element in table scope</a>, ignore the token. (<a href=#fragment-case>fragment
+    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-select-scope title="has an element in select scope">have a <code>select</code>
+    element in select scope</a>, ignore the token. (<a href=#fragment-case>fragment
     case</a>)</p>
 
     <p>Otherwise, act as if an end tag with the tag name "select" had
@@ -82831,7 +82826,11 @@
      <i>loop</i>.</li>
 
      <li><p>Otherwise, process the token <a href=#using-the-rules-for>using the rules
-     for</a> the <a href=#secondary-insertion-mode>secondary insertion mode</a>.</li>
+     for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in
+     body</a>" <a href=#insertion-mode>insertion mode</a>, except that if those
+     rules say to reprocess the token, these steps must be finished
+     first (i.e. the insertion mode is reset by the following step
+     before the token is reprocessed).</li>
 
      <li><p>If the <a href=#insertion-mode>insertion mode</a> is still "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
      content</a>", <a href=#reset-the-insertion-mode-appropriately>reset the insertion mode
@@ -82845,24 +82844,28 @@
    <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">ms</code> element in the <a href=#mathml-namespace>MathML namespace</a></dt>
    <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">mtext</code> element in the <a href=#mathml-namespace>MathML namespace</a></dt>
    <dt>A start tag whose tag name is "svg", if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a></dt>
+   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">text/html</code>"</dt>
+   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">application/xhtml+xml</code>"</dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">foreignObject</code> element in the <a href=#svg-namespace>SVG namespace</a></dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">desc</code> element in the <a href=#svg-namespace>SVG namespace</a></dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">title</code> element in the <a href=#svg-namespace>SVG namespace</a></dt>
-   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">text/html</code>"</dt>
-   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">application/xhtml+xml</code>"</dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is an element in the <a href=#html-namespace-0>HTML namespace</a></dt>
    <dt>Any other end tag</dt>
    <dd>
 
-    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the
-    <a href=#secondary-insertion-mode>secondary insertion mode</a>.</p>
+    <ol><li><p>Process the token <a href=#using-the-rules-for>using the rules for</a> the
+     "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>"
+     <a href=#insertion-mode>insertion mode</a>, except that if those rules say to
+     reprocess the token, these steps must be finished first (i.e. the
+     insertion mode is reset by the following step before the token is
+     reprocessed).</li>
 
-    <p>If, after doing so, the <a href=#insertion-mode>insertion mode</a> is still
-    "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
-    content</a>", <a href=#reset-the-insertion-mode-appropriately>reset the insertion mode
-    appropriately</a>.</p>
+     <li><p>If, after doing so, the <a href=#insertion-mode>insertion mode</a> is
+     still "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in
+     foreign content</a>", <a href=#reset-the-insertion-mode-appropriately>reset the insertion mode
+     appropriately</a>.</li>
 
-   </dd>
+    </ol></dd>
 
    <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",
    "blockquote", "body"<!--by inspection-->, "br", "center", "code",

Modified: index
===================================================================
--- index	2010-09-26 21:03:32 UTC (rev 5520)
+++ index	2010-09-27 23:45:12 UTC (rev 5521)
@@ -215,7 +215,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1>HTML5 (including next generation additions still in development)</h1>
-    <h2 class="no-num no-toc">Draft Standard — 26 September 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 27 September 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -73056,20 +73056,18 @@
   how tokens are processed and whether CDATA sections are
   supported.</p>
 
-  <p>Seven of these modes, namely "<a href=#parsing-main-inhead title="insertion mode: in
+  <p>Several of these modes, namely "<a href=#parsing-main-inhead title="insertion mode: in
   head">in head</a>", "<a href=#parsing-main-inbody title="insertion mode: in body">in
   body</a>", "<a href=#parsing-main-intable title="insertion mode: in table">in
-  table</a>", "<a href=#parsing-main-intbody title="insertion mode: in table body">in table
-  body</a>", "<a href=#parsing-main-intr title="insertion mode: in row">in row</a>",
-  "<a href=#parsing-main-intd title="insertion mode: in cell">in cell</a>", and "<a href=#parsing-main-inselect title="insertion mode: in select">in select</a>", are special, in
-  that the other modes defer to them at various times. When the
-  algorithm below says that the user agent is to do something
-  "<dfn id=using-the-rules-for>using the rules for</dfn> the <var title="">m</var> insertion
-  mode", where <var title="">m</var> is one of these modes, the user
-  agent must use the rules described under the <var title="">m</var>
-  <a href=#insertion-mode>insertion mode</a>'s section, but must leave the
-  <a href=#insertion-mode>insertion mode</a> unchanged unless the rules in <var title="">m</var> themselves switch the <a href=#insertion-mode>insertion mode</a>
-  to a new value.</p>
+  table</a>", and "<a href=#parsing-main-inselect title="insertion mode: in select">in
+  select</a>", are special, in that the other modes defer to them
+  at various times. When the algorithm below says that the user agent
+  is to do something "<dfn id=using-the-rules-for>using the rules for</dfn> the <var title="">m</var> insertion mode", where <var title="">m</var> is one
+  of these modes, the user agent must use the rules described under
+  the <var title="">m</var> <a href=#insertion-mode>insertion mode</a>'s section, but
+  must leave the <a href=#insertion-mode>insertion mode</a> unchanged unless the
+  rules in <var title="">m</var> themselves switch the <a href=#insertion-mode>insertion
+  mode</a> to a new value.</p>
 
   <p>When the insertion mode is switched to "<a href=#parsing-main-incdata title="insertion
   mode: text">text</a>" or "<a href=#parsing-main-intabletext title="insertion mode: in table
@@ -73077,21 +73075,12 @@
   is also set. This is the insertion mode to which the tree
   construction stage will return.</p>
 
-  <p>When the insertion mode is switched to "<a href=#parsing-main-inforeign title="insertion
-  mode: in foreign content">in foreign content</a>", the
-  <dfn id=secondary-insertion-mode>secondary insertion mode</dfn> is also set. This secondary mode
-  is used within the rules for the "<a href=#parsing-main-inforeign title="insertion mode: in
-  foreign content">in foreign content</a>" mode to handle HTML
-  (i.e. not foreign) content.</p>
-
   <hr><p>When the steps below require the UA to <dfn id=reset-the-insertion-mode-appropriately>reset the insertion
   mode appropriately</dfn>, it means the UA must follow these
   steps:</p>
 
   <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>
 
@@ -73100,59 +73089,56 @@
    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 jump to the
-   step labeled <i title="">end</i>. (<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 abort these
+   steps. (<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 jump to the step labeled <i title="">end</i>.</li>
+   mode: in cell">in cell</a>" and abort these steps.</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 jump to the step labeled <i title="">end</i>.</li>
+   mode: in row">in row</a>" and abort these steps.</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 jump to the step labeled <i title="">end</i>.</li>
+   table body">in table body</a>" and abort these steps.</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 jump to
-   the step labeled <i title="">end</i>.</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 abort
+   these steps.</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
-   jump to the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment
-   case</a>)</li>
+   abort these steps. (<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 jump to the
-   step labeled <i title="">end</i>.</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 abort these
+   steps.</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 jump to
-   the step labeled <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. -->
+   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. -->
 
    <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 jump to the
-   step labeled <i title="">end</i>.</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 abort these
+   steps.</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 jump to
-   the step labeled <i title="">end</i>. (<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 abort
+   these steps. (<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
@@ -73160,28 +73146,27 @@
    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, --> jump to the step labeled <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 -->
+   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 -->
 
    <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 <var title="">foreign</var> to true.</li>
+   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>" and abort these
+   steps.</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 jump to the step labeled <i title="">end</i>. (<a href=#fragment-case>fragment case</a>)</li>
+   body">in body</a>" and abort these steps. (<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 the step labeled <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>10.2.3.2 </span>The stack of open elements</h5>
 
   <p>Initially, the <dfn id=stack-of-open-elements>stack of open elements</dfn> is empty. The
@@ -73297,8 +73282,15 @@
    <li><code><a href=#the-th-element>th</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
    <li><code><a href=#the-marquee-element>marquee</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
    <li><code><a href=#the-object-element>object</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
+   <li><code title="">mi</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">mo</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">mn</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">ms</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
+   <li><code title="">mtext</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
    <li><code title="">annotation-xml</code> in the <a href=#mathml-namespace>MathML namespace</a></li>
    <li><code title="">foreignObject</code> in the <a href=#svg-namespace>SVG namespace</a></li>
+   <li><code title="">desc</code> in the <a href=#svg-namespace>SVG namespace</a></li>
+   <li><code title="">title</code> in the <a href=#svg-namespace>SVG namespace</a></li>
   </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-list-item-scope title="has an element in list item scope">have an element in list
   item scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
   scope</a> consisting of the following element types:</p>
@@ -73320,6 +73312,13 @@
 
   <ul class=brief><li><code><a href=#the-html-element-0>html</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li> <!-- (This can only happen if the <var title="">node</var> is the topmost node of the <span>stack of open elements</span>, and prevents the next step from being invoked if there are no more elements in the stack.) -->
    <li><code><a href=#the-table-element>table</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
+  </ul><p>The <a href=#stack-of-open-elements>stack of open elements</a> is said to <dfn id=has-an-element-in-select-scope title="has an element in select scope">have an element in select
+  scope</dfn> when it <a href=#has-an-element-in-the-specific-scope>has an element in the specific
+  scope</a> consisting of all element types <em>except</em> the
+  following:</p>
+
+  <ul class=brief><!--<li><code>select</code> in the <span>HTML namespace</span></li>--><li><code><a href=#the-optgroup-element>optgroup</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
+   <li><code><a href=#the-option-element>option</a></code> in the <a href=#html-namespace-0>HTML namespace</a></li>
   </ul><p>Nothing happens if at any time any of the elements in the
   <a href=#stack-of-open-elements>stack of open elements</a> are moved to a new location in,
   or removed from, the <code><a href=#document>Document</a></code> tree. In particular, the
@@ -77570,10 +77569,8 @@
 
     <p>Otherwise, if the <a href=#insertion-mode>insertion mode</a> is not already
     "<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
-    the current <a href=#insertion-mode>insertion mode</a>, and 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>".</p>
+    content</a>", 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>".</p>
 
    </dd>
 
@@ -77606,10 +77603,8 @@
 
     <p>Otherwise, if the <a href=#insertion-mode>insertion mode</a> is not already
     "<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
-    the current <a href=#insertion-mode>insertion mode</a>, and 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>".</p>
+    content</a>", 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>".</p>
 
    </dd>
 
@@ -78564,7 +78559,7 @@
    <dt>An end tag whose tag name is "select"</dt>
    <dd>
 
-    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have an element in table
+    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-select-scope title="has an element in select scope">have an element in select
     scope</a> with the same tag name as the token, this is a
     <a href=#parse-error>parse error</a>. Ignore the token. (<a href=#fragment-case>fragment
     case</a>)</p>
@@ -78592,8 +78587,8 @@
 
     <p><a href=#parse-error>Parse error</a>.</p>
 
-    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope title="has an element in table scope">have a <code>select</code>
-    element in table scope</a>, ignore the token. (<a href=#fragment-case>fragment
+    <p>If the <a href=#stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-select-scope title="has an element in select scope">have a <code>select</code>
+    element in select scope</a>, ignore the token. (<a href=#fragment-case>fragment
     case</a>)</p>
 
     <p>Otherwise, act as if an end tag with the tag name "select" had
@@ -78749,7 +78744,11 @@
      <i>loop</i>.</li>
 
      <li><p>Otherwise, process the token <a href=#using-the-rules-for>using the rules
-     for</a> the <a href=#secondary-insertion-mode>secondary insertion mode</a>.</li>
+     for</a> the "<a href=#parsing-main-inbody title="insertion mode: in body">in
+     body</a>" <a href=#insertion-mode>insertion mode</a>, except that if those
+     rules say to reprocess the token, these steps must be finished
+     first (i.e. the insertion mode is reset by the following step
+     before the token is reprocessed).</li>
 
      <li><p>If the <a href=#insertion-mode>insertion mode</a> is still "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
      content</a>", <a href=#reset-the-insertion-mode-appropriately>reset the insertion mode
@@ -78763,24 +78762,28 @@
    <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">ms</code> element in the <a href=#mathml-namespace>MathML namespace</a></dt>
    <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <a href=#current-node>current node</a> is an <code title="">mtext</code> element in the <a href=#mathml-namespace>MathML namespace</a></dt>
    <dt>A start tag whose tag name is "svg", if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a></dt>
+   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">text/html</code>"</dt>
+   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">application/xhtml+xml</code>"</dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">foreignObject</code> element in the <a href=#svg-namespace>SVG namespace</a></dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">desc</code> element in the <a href=#svg-namespace>SVG namespace</a></dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is a <code title="">title</code> element in the <a href=#svg-namespace>SVG namespace</a></dt>
-   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">text/html</code>"</dt>
-   <dt>A start tag, if the <a href=#current-node>current node</a> is an <code title="">annotation-xml</code> element in the <a href=#mathml-namespace>MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href=#ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code title="">application/xhtml+xml</code>"</dt>
    <dt>A start tag, if the <a href=#current-node>current node</a> is an element in the <a href=#html-namespace-0>HTML namespace</a></dt>
    <dt>Any other end tag</dt>
    <dd>
 
-    <p>Process the token <a href=#using-the-rules-for>using the rules for</a> the
-    <a href=#secondary-insertion-mode>secondary insertion mode</a>.</p>
+    <ol><li><p>Process the token <a href=#using-the-rules-for>using the rules for</a> the
+     "<a href=#parsing-main-inbody title="insertion mode: in body">in body</a>"
+     <a href=#insertion-mode>insertion mode</a>, except that if those rules say to
+     reprocess the token, these steps must be finished first (i.e. the
+     insertion mode is reset by the following step before the token is
+     reprocessed).</li>
 
-    <p>If, after doing so, the <a href=#insertion-mode>insertion mode</a> is still
-    "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in foreign
-    content</a>", <a href=#reset-the-insertion-mode-appropriately>reset the insertion mode
-    appropriately</a>.</p>
+     <li><p>If, after doing so, the <a href=#insertion-mode>insertion mode</a> is
+     still "<a href=#parsing-main-inforeign title="insertion mode: in foreign content">in
+     foreign content</a>", <a href=#reset-the-insertion-mode-appropriately>reset the insertion mode
+     appropriately</a>.</li>
 
-   </dd>
+    </ol></dd>
 
    <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",
    "blockquote", "body"<!--by inspection-->, "br", "center", "code",

Modified: source
===================================================================
--- source	2010-09-26 21:03:32 UTC (rev 5520)
+++ source	2010-09-27 23:45:12 UTC (rev 5521)
@@ -88113,22 +88113,19 @@
   how tokens are processed and whether CDATA sections are
   supported.</p>
 
-  <p>Seven of these modes, namely "<span title="insertion mode: in
+  <p>Several of these modes, namely "<span title="insertion mode: in
   head">in head</span>", "<span title="insertion mode: in body">in
   body</span>", "<span title="insertion mode: in table">in
-  table</span>", "<span title="insertion mode: in table body">in table
-  body</span>", "<span title="insertion mode: in row">in row</span>",
-  "<span title="insertion mode: in cell">in cell</span>", and "<span
-  title="insertion mode: in select">in select</span>", are special, in
-  that the other modes defer to them at various times. When the
-  algorithm below says that the user agent is to do something
-  "<dfn>using the rules for</dfn> the <var title="">m</var> insertion
-  mode", where <var title="">m</var> is one of these modes, the user
-  agent must use the rules described under the <var title="">m</var>
-  <span>insertion mode</span>'s section, but must leave the
-  <span>insertion mode</span> unchanged unless the rules in <var
-  title="">m</var> themselves switch the <span>insertion mode</span>
-  to a new value.</p>
+  table</span>", and "<span title="insertion mode: in select">in
+  select</span>", are special, in that the other modes defer to them
+  at various times. When the algorithm below says that the user agent
+  is to do something "<dfn>using the rules for</dfn> the <var
+  title="">m</var> insertion mode", where <var title="">m</var> is one
+  of these modes, the user agent must use the rules described under
+  the <var title="">m</var> <span>insertion mode</span>'s section, but
+  must leave the <span>insertion mode</span> unchanged unless the
+  rules in <var title="">m</var> themselves switch the <span>insertion
+  mode</span> to a new value.</p>
 
   <p>When the insertion mode is switched to "<span title="insertion
   mode: text">text</span>" or "<span title="insertion mode: in table
@@ -88136,13 +88133,6 @@
   is also set. This is the insertion mode to which the tree
   construction stage will return.</p>
 
-  <p>When the insertion mode is switched to "<span title="insertion
-  mode: in foreign content">in foreign content</span>", the
-  <dfn>secondary insertion mode</dfn> is also set. This secondary mode
-  is used within the rules for the "<span title="insertion mode: in
-  foreign content">in foreign content</span>" mode to handle HTML
-  (i.e. not foreign) content.</p>
-
   <hr>
 
   <p>When the steps below require the UA to <dfn>reset the insertion
@@ -88153,8 +88143,6 @@
 
    <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
    <span>stack of open elements</span>.</li>
 
@@ -88165,70 +88153,64 @@
 
    <li>If <var title="">node</var> is a <code>select</code> element,
    then switch the <span>insertion mode</span> to "<span
-   title="insertion mode: in select">in select</span>" and jump to the
-   step labeled <i title="">end</i>. (<span>fragment case</span>)</li>
+   title="insertion mode: in select">in select</span>" and abort these
+   steps. (<span>fragment case</span>)</li>
 
    <li>If <var title="">node</var> is a <code>td</code> or
    <code>th</code> element and <var title="">last</var> is false, then
    switch the <span>insertion mode</span> to "<span title="insertion
-   mode: in cell">in cell</span>" and jump to the step labeled <i
-   title="">end</i>.</li>
+   mode: in cell">in cell</span>" and abort these steps.</li>
 
    <li>If <var title="">node</var> is a <code>tr</code> element, then
    switch the <span>insertion mode</span> to "<span title="insertion
-   mode: in row">in row</span>" and jump to the step labeled <i
-   title="">end</i>.</li>
+   mode: in row">in row</span>" and abort these steps.</li>
 
    <li>If <var title="">node</var> is a <code>tbody</code>,
    <code>thead</code>, or <code>tfoot</code> element, then switch the
    <span>insertion mode</span> to "<span title="insertion mode: in
-   table body">in table body</span>" and jump to the step labeled <i
-   title="">end</i>.</li>
+   table body">in table body</span>" and abort these steps.</li>
 
    <li>If <var title="">node</var> is a <code>caption</code> element,
    then switch the <span>insertion mode</span> to "<span
-   title="insertion mode: in caption">in caption</span>" and jump to
-   the step labeled <i title="">end</i>.</li>
+   title="insertion mode: in caption">in caption</span>" and abort
+   these steps.</li>
 
    <li>If <var title="">node</var> is a <code>colgroup</code> element,
    then switch the <span>insertion mode</span> to "<span
    title="insertion mode: in column group">in column group</span>" and
-   jump to the step labeled <i title="">end</i>. (<span>fragment
-   case</span>)</li>
+   abort these steps. (<span>fragment case</span>)</li>
 
    <li>If <var title="">node</var> is a <code>table</code> element,
    then switch the <span>insertion mode</span> to "<span
-   title="insertion mode: in table">in table</span>" and jump to the
-   step labeled <i title="">end</i>.</li>
+   title="insertion mode: in table">in table</span>" and abort these
+   steps.</li>
 
    <li>If <var title="">node</var> is a <code>head</code> element,
    then switch the <span>insertion mode</span> to "<span
    title="insertion mode: in body">in body</span>" ("<span
    title="insertion mode: in body">in body</span>"! <em> not "<span
-   title="insertion mode: in head">in head</span>"</em>!) and jump to
-   the step labeled <i title="">end</i>. (<span>fragment
-   case</span>)</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. -->
+   title="insertion mode: in head">in head</span>"</em>!) and abort
+   these steps. (<span>fragment case</span>)</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>body</code> element,
    then switch the <span>insertion mode</span> to "<span
-   title="insertion mode: in body">in body</span>" and jump to the
-   step labeled <i title="">end</i>.</li>
+   title="insertion mode: in body">in body</span>" and abort these
+   steps.</li>
 
    <li>If <var title="">node</var> is a <code>frameset</code> element,
    then switch the <span>insertion mode</span> to "<span
-   title="insertion mode: in frameset">in frameset</span>" and jump to
-   the step labeled <i title="">end</i>. (<span>fragment
-   case</span>)</li>
+   title="insertion mode: in frameset">in frameset</span>" and abort
+   these steps. (<span>fragment case</span>)</li>
 
    <li>If <var title="">node</var> is an <code>html</code> element,
    then <!--: if the <span><code title="">head</code> element
@@ -88236,19 +88218,21 @@
    to "<span title="insertion mode: before head">before
    head</span>"<!--, otherwise, switch the <span>insertion mode</span>
    to "<span title="insertion mode: after head">after head</span>".-->
-   Then, <!-- in either case, --> jump to the step labeled <i
-   title="">end</i>. (<span>fragment case</span>)</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, --> abort these steps. (<span>fragment
+   case</span>)</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 <span>MathML
-   namespace</span> or the <span>SVG namespace</span>, then set <var
-   title="">foreign</var> to true.</li>
+   namespace</span> or the <span>SVG namespace</span>, then switch the
+   <span>insertion mode</span> to "<span title="insertion mode: in
+   foreign content">in foreign content</span>" and abort these
+   steps.</li>
 
    <li>If <var title="">last</var> is true, then switch the
    <span>insertion mode</span> to "<span title="insertion mode: in
-   body">in body</span>" and jump to the step labeled <i
-   title="">end</i>. (<span>fragment case</span>)</li>
+   body">in body</span>" and abort these steps. (<span>fragment
+   case</span>)</li>
 
    <li>Let <var title="">node</var> now be the node before <var
    title="">node</var> in the <span>stack of open
@@ -88256,12 +88240,6 @@
 
    <li>Return to the step labeled <i>loop</i>.</li>
 
-   <li><i>End</i>: If <var title="">foreign</var> is true, switch the
-   <span>secondary insertion mode</span> to whatever the
-   <span>insertion mode</span> is set to, and switch the
-   <span>insertion mode</span> to "<span title="insertion mode: in
-   foreign content">in foreign content</span>".</li>
-
   </ol>
 
 
@@ -88393,8 +88371,15 @@
    <li><code>th</code> in the <span>HTML namespace</span></li>
    <li><code>marquee</code> in the <span>HTML namespace</span></li>
    <li><code>object</code> in the <span>HTML namespace</span></li>
+   <li><code title="">mi</code> in the <span>MathML namespace</span></li>
+   <li><code title="">mo</code> in the <span>MathML namespace</span></li>
+   <li><code title="">mn</code> in the <span>MathML namespace</span></li>
+   <li><code title="">ms</code> in the <span>MathML namespace</span></li>
+   <li><code title="">mtext</code> in the <span>MathML namespace</span></li>
    <li><code title="">annotation-xml</code> in the <span>MathML namespace</span></li>
    <li><code title="">foreignObject</code> in the <span>SVG namespace</span></li>
+   <li><code title="">desc</code> in the <span>SVG namespace</span></li>
+   <li><code title="">title</code> in the <span>SVG namespace</span></li>
   </ul>
 
   <p>The <span>stack of open elements</span> is said to <dfn
@@ -88430,6 +88415,18 @@
    <li><code>table</code> in the <span>HTML namespace</span></li>
   </ul>
 
+  <p>The <span>stack of open elements</span> is said to <dfn
+  title="has an element in select scope">have an element in select
+  scope</dfn> when it <span>has an element in the specific
+  scope</span> consisting of all element types <em>except</em> the
+  following:</p>
+
+  <ul class="brief">
+   <!--<li><code>select</code> in the <span>HTML namespace</span></li>-->
+   <li><code>optgroup</code> in the <span>HTML namespace</span></li>
+   <li><code>option</code> in the <span>HTML namespace</span></li>
+  </ul>
+
   <p>Nothing happens if at any time any of the elements in the
   <span>stack of open elements</span> are moved to a new location in,
   or removed from, the <code>Document</code> tree. In particular, the
@@ -93226,10 +93223,9 @@
 
     <p>Otherwise, if the <span>insertion mode</span> is not already
     "<span title="insertion mode: in foreign content">in foreign
-    content</span>", let the <span>secondary insertion mode</span> be
-    the current <span>insertion mode</span>, and then switch the
-    <span>insertion mode</span> to "<span title="insertion mode: in
-    foreign content">in foreign content</span>".</p>
+    content</span>", switch the <span>insertion mode</span> to "<span
+    title="insertion mode: in foreign content">in foreign
+    content</span>".</p>
 
    </dd>
 
@@ -93262,10 +93258,9 @@
 
     <p>Otherwise, if the <span>insertion mode</span> is not already
     "<span title="insertion mode: in foreign content">in foreign
-    content</span>", let the <span>secondary insertion mode</span> be
-    the current <span>insertion mode</span>, and then switch the
-    <span>insertion mode</span> to "<span title="insertion mode: in
-    foreign content">in foreign content</span>".</p>
+    content</span>", switch the <span>insertion mode</span> to "<span
+    title="insertion mode: in foreign content">in foreign
+    content</span>".</p>
 
    </dd>
 
@@ -94317,7 +94312,7 @@
    <dd>
 
     <p>If the <span>stack of open elements</span> does not <span
-    title="has an element in table scope">have an element in table
+    title="has an element in select scope">have an element in select
     scope</span> with the same tag name as the token, this is a
     <span>parse error</span>. Ignore the token. (<span>fragment
     case</span>)</p>
@@ -94346,8 +94341,8 @@
     <p><span>Parse error</span>.</p>
 
     <p>If the <span>stack of open elements</span> does not <span
-    title="has an element in table scope">have a <code>select</code>
-    element in table scope</span>, ignore the token. (<span>fragment
+    title="has an element in select scope">have a <code>select</code>
+    element in select scope</span>, ignore the token. (<span>fragment
     case</span>)</p>
 
     <p>Otherwise, act as if an end tag with the tag name "select" had
@@ -94521,7 +94516,11 @@
      <i>loop</i>.</p></li>
 
      <li><p>Otherwise, process the token <span>using the rules
-     for</span> the <span>secondary insertion mode</span>.</p></li>
+     for</span> the "<span title="insertion mode: in body">in
+     body</span>" <span>insertion mode</span>, except that if those
+     rules say to reprocess the token, these steps must be finished
+     first (i.e. the insertion mode is reset by the following step
+     before the token is reprocessed).</p></li>
 
      <li><p>If the <span>insertion mode</span> is still "<span
      title="insertion mode: in foreign content">in foreign
@@ -94538,23 +94537,31 @@
    <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <span>current node</span> is an <code title="">ms</code> element in the <span>MathML namespace</span></dt>
    <dt>A start tag whose tag name is neither "mglyph" nor "malignmark", if the <span>current node</span> is an <code title="">mtext</code> element in the <span>MathML namespace</span></dt>
    <dt>A start tag whose tag name is "svg", if the <span>current node</span> is an <code title="">annotation-xml</code> element in the <span>MathML namespace</span></dt>
+   <dt>A start tag, if the <span>current node</span> is an <code title="">annotation-xml</code> element in the <span>MathML namespace</span> whose start tag token had an attribute with the name "encoding" whose value was an <span>ASCII case-insensitive</span> match for the string "<code title="">text/html</code>"</dt>
+   <dt>A start tag, if the <span>current node</span> is an <code title="">annotation-xml</code> element in the <span>MathML namespace</span> whose start tag token had an attribute with the name "encoding" whose value was an <span>ASCII case-insensitive</span> match for the string "<code title="">application/xhtml+xml</code>"</dt>
    <dt>A start tag, if the <span>current node</span> is a <code title="">foreignObject</code> element in the <span>SVG namespace</span></dt>
    <dt>A start tag, if the <span>current node</span> is a <code title="">desc</code> element in the <span>SVG namespace</span></dt>
    <dt>A start tag, if the <span>current node</span> is a <code title="">title</code> element in the <span>SVG namespace</span></dt>
-   <dt>A start tag, if the <span>current node</span> is an <code title="">annotation-xml</code> element in the <span>MathML namespace</span> whose start tag token had an attribute with the name "encoding" whose value was an <span>ASCII case-insensitive</span> match for the string "<code title="">text/html</code>"</dt>
-   <dt>A start tag, if the <span>current node</span> is an <code title="">annotation-xml</code> element in the <span>MathML namespace</span> whose start tag token had an attribute with the name "encoding" whose value was an <span>ASCII case-insensitive</span> match for the string "<code title="">application/xhtml+xml</code>"</dt>
    <dt>A start tag, if the <span>current node</span> is an element in the <span>HTML namespace</span></dt>
    <dt>Any other end tag</dt>
    <dd>
 
-    <p>Process the token <span>using the rules for</span> the
-    <span>secondary insertion mode</span>.</p>
+    <ol>
 
-    <p>If, after doing so, the <span>insertion mode</span> is still
-    "<span title="insertion mode: in foreign content">in foreign
-    content</span>", <span>reset the insertion mode
-    appropriately</span>.</p>
+     <li><p>Process the token <span>using the rules for</span> the
+     "<span title="insertion mode: in body">in body</span>"
+     <span>insertion mode</span>, except that if those rules say to
+     reprocess the token, these steps must be finished first (i.e. the
+     insertion mode is reset by the following step before the token is
+     reprocessed).</p></li>
 
+     <li><p>If, after doing so, the <span>insertion mode</span> is
+     still "<span title="insertion mode: in foreign content">in
+     foreign content</span>", <span>reset the insertion mode
+     appropriately</span>.</p></li>
+
+    </ol>
+
    </dd>
 
    <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",




More information about the Commit-Watchers mailing list