W3C home > Mailing lists > Public > public-html-diffs@w3.org > February 2011

hixie: Change how MathML and SVG are parsed in text/html: use a three-level tree constructor design instead of the two-level design we had before. (whatwg r5920)

From: poot <cvsmail@w3.org>
Date: Mon, 28 Feb 2011 18:57:51 -0500
To: public-html-diffs@w3.org
Message-Id: <E1PuCyN-0003lX-0u@jay.w3.org>
hixie: Change how MathML and SVG are parsed in text/html: use a three-
level tree constructor design instead of the two-level design we had
before. (whatwg r5920)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4760&r2=1.4761&f=h
http://html5.org/tools/web-apps-tracker?from=5919&to=5920

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4760
retrieving revision 1.4761
diff -u -d -r1.4760 -r1.4761
--- Overview.html	28 Feb 2011 22:16:27 -0000	1.4760
+++ Overview.html	28 Feb 2011 23:56:29 -0000	1.4761
@@ -1238,29 +1238,31 @@
        <li><a href="#creating-and-inserting-elements"><span class="secno">8.2.5.1 </span>Creating and inserting elements</a></li>
        <li><a href="#closing-elements-that-have-implied-end-tags"><span class="secno">8.2.5.2 </span>Closing elements that have implied end tags</a></li>
        <li><a href="#foster-parenting"><span class="secno">8.2.5.3 </span>Foster parenting</a></li>
-       <li><a href="#the-initial-insertion-mode"><span class="secno">8.2.5.4 </span>The "initial" insertion mode</a></li>
-       <li><a href="#the-before-html-insertion-mode"><span class="secno">8.2.5.5 </span>The "before html" insertion mode</a></li>
-       <li><a href="#the-before-head-insertion-mode"><span class="secno">8.2.5.6 </span>The "before head" insertion mode</a></li>
-       <li><a href="#parsing-main-inhead"><span class="secno">8.2.5.7 </span>The "in head" insertion mode</a></li>
-       <li><a href="#parsing-main-inheadnoscript"><span class="secno">8.2.5.8 </span>The "in head noscript" insertion mode</a></li>
-       <li><a href="#the-after-head-insertion-mode"><span class="secno">8.2.5.9 </span>The "after head" insertion mode</a></li>
-       <li><a href="#parsing-main-inbody"><span class="secno">8.2.5.10 </span>The "in body" insertion mode</a></li>
-       <li><a href="#parsing-main-incdata"><span class="secno">8.2.5.11 </span>The "text" insertion mode</a></li>
-       <li><a href="#parsing-main-intable"><span class="secno">8.2.5.12 </span>The "in table" insertion mode</a></li>
-       <li><a href="#parsing-main-intabletext"><span class="secno">8.2.5.13 </span>The "in table text" insertion mode</a></li>
-       <li><a href="#parsing-main-incaption"><span class="secno">8.2.5.14 </span>The "in caption" insertion mode</a></li>
-       <li><a href="#parsing-main-incolgroup"><span class="secno">8.2.5.15 </span>The "in column group" insertion mode</a></li>
-       <li><a href="#parsing-main-intbody"><span class="secno">8.2.5.16 </span>The "in table body" insertion mode</a></li>
-       <li><a href="#parsing-main-intr"><span class="secno">8.2.5.17 </span>The "in row" insertion mode</a></li>
-       <li><a href="#parsing-main-intd"><span class="secno">8.2.5.18 </span>The "in cell" insertion mode</a></li>
-       <li><a href="#parsing-main-inselect"><span class="secno">8.2.5.19 </span>The "in select" insertion mode</a></li>
-       <li><a href="#parsing-main-inselectintable"><span class="secno">8.2.5.20 </span>The "in select in table" insertion mode</a></li>
-       <li><a href="#parsing-main-inforeign"><span class="secno">8.2.5.21 </span>The "in foreign content" insertion mode</a></li>
-       <li><a href="#parsing-main-afterbody"><span class="secno">8.2.5.22 </span>The "after body" insertion mode</a></li>
-       <li><a href="#parsing-main-inframeset"><span class="secno">8.2.5.23 </span>The "in frameset" insertion mode</a></li>
-       <li><a href="#parsing-main-afterframeset"><span class="secno">8.2.5.24 </span>The "after frameset" insertion mode</a></li>
-       <li><a href="#the-after-after-body-insertion-mode"><span class="secno">8.2.5.25 </span>The "after after body" insertion mode</a></li>
-       <li><a href="#the-after-after-frameset-insertion-mode"><span class="secno">8.2.5.26 </span>The "after after frameset" insertion mode</a></ol></li>
+       <li><a href="#parsing-main-inhtml"><span class="secno">8.2.5.4 </span>The rules for parsing tokens in HTML content</a>
+        <ol>
+         <li><a href="#the-initial-insertion-mode"><span class="secno">8.2.5.4.1 </span>The "initial" insertion mode</a></li>
+         <li><a href="#the-before-html-insertion-mode"><span class="secno">8.2.5.4.2 </span>The "before html" insertion mode</a></li>
+         <li><a href="#the-before-head-insertion-mode"><span class="secno">8.2.5.4.3 </span>The "before head" insertion mode</a></li>
+         <li><a href="#parsing-main-inhead"><span class="secno">8.2.5.4.4 </span>The "in head" insertion mode</a></li>
+         <li><a href="#parsing-main-inheadnoscript"><span class="secno">8.2.5.4.5 </span>The "in head noscript" insertion mode</a></li>
+         <li><a href="#the-after-head-insertion-mode"><span class="secno">8.2.5.4.6 </span>The "after head" insertion mode</a></li>
+         <li><a href="#parsing-main-inbody"><span class="secno">8.2.5.4.7 </span>The "in body" insertion mode</a></li>
+         <li><a href="#parsing-main-incdata"><span class="secno">8.2.5.4.8 </span>The "text" insertion mode</a></li>
+         <li><a href="#parsing-main-intable"><span class="secno">8.2.5.4.9 </span>The "in table" insertion mode</a></li>
+         <li><a href="#parsing-main-intabletext"><span class="secno">8.2.5.4.10 </span>The "in table text" insertion mode</a></li>
+         <li><a href="#parsing-main-incaption"><span class="secno">8.2.5.4.11 </span>The "in caption" insertion mode</a></li>
+         <li><a href="#parsing-main-incolgroup"><span class="secno">8.2.5.4.12 </span>The "in column group" insertion mode</a></li>
+         <li><a href="#parsing-main-intbody"><span class="secno">8.2.5.4.13 </span>The "in table body" insertion mode</a></li>
+         <li><a href="#parsing-main-intr"><span class="secno">8.2.5.4.14 </span>The "in row" insertion mode</a></li>
+         <li><a href="#parsing-main-intd"><span class="secno">8.2.5.4.15 </span>The "in cell" insertion mode</a></li>
+         <li><a href="#parsing-main-inselect"><span class="secno">8.2.5.4.16 </span>The "in select" insertion mode</a></li>
+         <li><a href="#parsing-main-inselectintable"><span class="secno">8.2.5.4.17 </span>The "in select in table" insertion mode</a></li>
+         <li><a href="#parsing-main-afterbody"><span class="secno">8.2.5.4.18 </span>The "after body" insertion mode</a></li>
+         <li><a href="#parsing-main-inframeset"><span class="secno">8.2.5.4.19 </span>The "in frameset" insertion mode</a></li>
+         <li><a href="#parsing-main-afterframeset"><span class="secno">8.2.5.4.20 </span>The "after frameset" insertion mode</a></li>
+         <li><a href="#the-after-after-body-insertion-mode"><span class="secno">8.2.5.4.21 </span>The "after after body" insertion mode</a></li>
+         <li><a href="#the-after-after-frameset-insertion-mode"><span class="secno">8.2.5.4.22 </span>The "after after frameset" insertion mode</a></ol></li>
+       <li><a href="#parsing-main-inforeign"><span class="secno">8.2.5.5 </span>The rules for parsing tokens in foreign content</a></ol></li>
      <li><a href="#the-end"><span class="secno">8.2.6 </span>The end</a></li>
      <li><a href="#coercing-an-html-dom-into-an-infoset"><span class="secno">8.2.7 </span>Coercing an HTML DOM into an infoset</a></li>
      <li><a href="#an-introduction-to-error-handling-and-strange-cases-in-the-parser"><span class="secno">8.2.8 </span>An introduction to error handling and strange cases in the parser</a>
@@ -55752,12 +55754,16 @@
   "<a href="#the-before-html-insertion-mode" title="insertion mode: before html">before html</a>",
   "<a href="#the-before-head-insertion-mode" title="insertion mode: before head">before head</a>",
   "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>", "<a href="#parsing-main-inheadnoscript" title="insertion mode: in head noscript">in head noscript</a>",
-  "<a href="#the-after-head-insertion-mode" title="insertion mode: after head">after head</a>", "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>", "<a href="#parsing-main-incdata" title="insertion mode: text">text</a>",
-  "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>", "<a href="#parsing-main-intabletext" title="insertion mode: in table text">in table text</a>", "<a href="#parsing-main-incaption" title="insertion mode: in caption">in caption</a>", "<a href="#parsing-main-incolgroup" title="insertion mode: in column group">in column group</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>", "<a href="#parsing-main-inselect" title="insertion mode: in select">in select</a>", "<a href="#parsing-main-inselectintable" title="insertion mode: in select in table">in select in
-  table</a>", "<a href="#parsing-main-inforeign" title="insertion mode: in foreign content">in
-  foreign content</a>", "<a href="#parsing-main-afterbody" title="insertion mode: after
+  "<a href="#the-after-head-insertion-mode" title="insertion mode: after head">after head</a>", "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>", "<a href="#parsing-main-incdata" title="insertion mode: text">text</a>", "<a href="#parsing-main-intable" title="insertion
+  mode: in table">in table</a>", "<a href="#parsing-main-intabletext" title="insertion mode: in
+  table text">in table text</a>", "<a href="#parsing-main-incaption" title="insertion mode: in
+  caption">in caption</a>", "<a href="#parsing-main-incolgroup" title="insertion mode: in column
+  group">in column group</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>", "<a href="#parsing-main-inselect" title="insertion mode: in select">in
+  select</a>", "<a href="#parsing-main-inselectintable" title="insertion mode: in select in table">in
+  select in table</a>", "<a href="#parsing-main-afterbody" title="insertion mode: after
   body">after body</a>", "<a href="#parsing-main-inframeset" title="insertion mode: in
   frameset">in frameset</a>", "<a href="#parsing-main-afterframeset" title="insertion mode: after
   frameset">after frameset</a>", "<a href="#the-after-after-body-insertion-mode" title="insertion mode:
@@ -55862,12 +55868,6 @@
    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 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 abort these steps. (<a href="#fragment-case">fragment
@@ -57472,11 +57472,10 @@
   case-insensitive</a> match for the word "DOCTYPE", then consume
   those characters and switch to the <a href="#doctype-state">DOCTYPE state</a>.</p>
 
-  <p>Otherwise, if the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inforeign" title="insertion mode: in foreign content">in foreign
-  content</a>" and the <a href="#current-node">current node</a> is not an element
-  in the <a href="#html-namespace-0">HTML namespace</a> and the next seven characters are
-  an <a href="#case-sensitive">case-sensitive</a> match for the string "[CDATA[" (the
-  five uppercase letters "CDATA" with a U+005B LEFT SQUARE BRACKET
+  <p>Otherwise, if the <a href="#current-node">current node</a> is not an element in
+  the <a href="#html-namespace-0">HTML namespace</a> and the next seven characters are an
+  <a href="#case-sensitive">case-sensitive</a> match for the string "[CDATA[" (the five
+  uppercase letters "CDATA" with a U+005B LEFT SQUARE BRACKET
   character before and after), then consume those characters and
   switch to the <a href="#cdata-section-state">CDATA section state</a>.</p>
 
@@ -58375,11 +58374,44 @@
   has to render the <code><a href="#document">Document</a></code> so that it is available to
   the user, or when it has to begin accepting user input.</p>
 
-  <p>As each token is emitted from the tokenizer, the user agent must
-  process the token according to the rules given in the section
-  corresponding to the current <a href="#insertion-mode">insertion mode</a>.</p>
+  <hr><p>As each token is emitted from the tokenizer, the user agent must
+  follow the appropriate steps from the following list:</p>
 
-  <p>When the steps below require the UA to <dfn id="insert-a-character">insert a
+  <dl class="switch"><dt>If there is no <a href="#current-node">current node</a></dt>
+   <dt>If the <a href="#current-node">current node</a> is an element in the <a href="#html-namespace-0">HTML namespace</a></dt>
+   <dt>If the <a href="#current-node">current node</a> is a <a href="#mathml-text-integration-point">MathML text integration point</a> and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"</dt>
+   <dt>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> and the token is a start tag whose tag name is "svg"</dt>
+   <dt>If the <a href="#current-node">current node</a> is an <a href="#html-integration-point">HTML integration point</a> and the token is a start tag</dt>
+   <dt>If the <a href="#current-node">current node</a> is an <a href="#html-integration-point">HTML integration point</a> and the token is a character token</dt>
+   <dt>If the token is an end-of-file token</dt>
+
+   <dd>Process the token according to the rules given in the section
+   corresponding to the current <a href="#insertion-mode">insertion mode</a> in HTML
+   content.</dd>
+
+   <dt>Otherwise</dt>
+
+   <dd>Process the token according to the rules given in the section
+   for parsing tokens <a href="#parsing-main-inforeign" title="insertion mode: in foreign
+   content">in foreign content</a>.</dd>
+
+  </dl><p>The <a href="#current-node">current node</a> is a <dfn id="mathml-text-integration-point">MathML text
+  integration point</dfn> if it is one of the following elements:</p>
+
+  <ul class="brief"><li>An <code title="">mi</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
+   <li>An <code title="">mo</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
+   <li>An <code title="">mn</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
+   <li>An <code title="">ms</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
+   <li>An <code title="">mtext</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
+  </ul><p>The <a href="#current-node">current node</a> is an <dfn id="html-integration-point">HTML
+  integration point</dfn> if it is one of the following elements:</p>
+
+  <ul class="brief"><li>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>"</li>
+   <li>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>"</li>
+   <li>A <code title="">foreignObject</code> element in the <a href="#svg-namespace">SVG namespace</a></li>
+   <li>A <code title="">desc</code> element in the <a href="#svg-namespace">SVG namespace</a></li>
+   <li>A <code title="">title</code> element in the <a href="#svg-namespace">SVG namespace</a></li>
+  </ul><hr><p>When the steps below require the UA to <dfn id="insert-a-character">insert a
   character</dfn> into a node, if that node has a child immediately
   before where the character is to be inserted, and that child is a
   <code><a href="#text">Text</a></code> node, then the character must be appended to that
@@ -58671,10 +58703,12 @@
 
 
 
-  <h5 id="the-initial-insertion-mode"><span class="secno">8.2.5.4 </span>The "<dfn title="insertion mode: initial">initial</dfn>" insertion mode</h5>
+  <h5 id="parsing-main-inhtml"><span class="secno">8.2.5.4 </span>The rules for parsing tokens in HTML content</h5>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#the-initial-insertion-mode" title="insertion
-  mode: initial">initial</a>", tokens must be handled as follows:</p>
+
+  <h6 id="the-initial-insertion-mode"><span class="secno">8.2.5.4.1 </span>The "<dfn title="insertion mode: initial">initial</dfn>" insertion mode</h6>
+
+  <p>When the user agent is to apply the rules for the "<a href="#the-initial-insertion-mode" title="insertion mode: initial">initial</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
    TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
@@ -58865,10 +58899,9 @@
 
    </dd>
 
-  </dl><h5 id="the-before-html-insertion-mode"><span class="secno">8.2.5.5 </span>The "<dfn title="insertion mode: before html">before html</dfn>" insertion mode</h5>
+  </dl><h6 id="the-before-html-insertion-mode"><span class="secno">8.2.5.4.2 </span>The "<dfn title="insertion mode: before html">before html</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#the-before-html-insertion-mode" title="insertion
-  mode: before html">before html</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#the-before-html-insertion-mode" title="insertion mode: before html">before html</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A DOCTYPE token</dt>
    <dd>
@@ -58949,10 +58982,9 @@
   as described in the next section.</p>
 
 
-  <h5 id="the-before-head-insertion-mode"><span class="secno">8.2.5.6 </span>The "<dfn title="insertion mode: before head">before head</dfn>" insertion mode</h5>
+  <h6 id="the-before-head-insertion-mode"><span class="secno">8.2.5.4.3 </span>The "<dfn title="insertion mode: before head">before head</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#the-before-head-insertion-mode" title="insertion
-  mode: before head">before head</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#the-before-head-insertion-mode" title="insertion mode: before head">before head</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
    TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
@@ -59015,10 +59047,9 @@
 
    </dd>
 
-  </dl><h5 id="parsing-main-inhead"><span class="secno">8.2.5.7 </span>The "<dfn title="insertion mode: in head">in head</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-inhead"><span class="secno">8.2.5.4.4 </span>The "<dfn title="insertion mode: in head">in head</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inhead" title="insertion
-  mode: in head">in head</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
    TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
@@ -59182,10 +59213,9 @@
 
    </dd>
 
-  </dl><h5 id="parsing-main-inheadnoscript"><span class="secno">8.2.5.8 </span>The "<dfn title="insertion mode: in head noscript">in head noscript</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-inheadnoscript"><span class="secno">8.2.5.4.5 </span>The "<dfn title="insertion mode: in head noscript">in head noscript</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inheadnoscript" title="insertion
-  mode: in head noscript">in head noscript</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inheadnoscript" title="insertion mode: in head noscript">in head noscript</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A DOCTYPE token</dt>
    <dd>
@@ -59243,10 +59273,9 @@
 
    </dd>
 
-  </dl><h5 id="the-after-head-insertion-mode"><span class="secno">8.2.5.9 </span>The "<dfn title="insertion mode: after head">after head</dfn>" insertion mode</h5>
+  </dl><h6 id="the-after-head-insertion-mode"><span class="secno">8.2.5.4.6 </span>The "<dfn title="insertion mode: after head">after head</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#the-after-head-insertion-mode" title="insertion
-  mode: after head">after head</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#the-after-head-insertion-mode" title="insertion mode: after head">after head</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
    TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
@@ -59334,10 +59363,9 @@
     token.</p>
    </dd>
 
-  </dl><h5 id="parsing-main-inbody"><span class="secno">8.2.5.10 </span>The "<dfn title="insertion mode: in body">in body</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-inbody"><span class="secno">8.2.5.4.7 </span>The "<dfn title="insertion mode: in body">in body</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inbody" title="insertion
-  mode: in body">in body</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
    <dd>
@@ -60500,11 +60528,6 @@
     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
 
-    <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>", 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>
 
    <dt>A start tag whose tag name is "svg"</dt>
@@ -60534,11 +60557,6 @@
     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
 
-    <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>", 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>
 
    <dt>A start <!--or end--> tag whose tag name is one of: "caption",
@@ -60607,10 +60625,9 @@
 
     </ol></dd>
 
-  </dl><h5 id="parsing-main-incdata"><span class="secno">8.2.5.11 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-incdata"><span class="secno">8.2.5.4.8 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-incdata" title="insertion
-  mode: text">text</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-incdata" title="insertion mode: text">text</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token</dt>
    <dd>
@@ -60760,10 +60777,9 @@
 
    </dd>
 
-  </dl><h5 id="parsing-main-intable"><span class="secno">8.2.5.12 </span>The "<dfn title="insertion mode: in table">in table</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-intable"><span class="secno">8.2.5.4.9 </span>The "<dfn title="insertion mode: in table">in table</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-intable" title="insertion
-  mode: in table">in table</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token</dt>
    <dd>
@@ -60964,11 +60980,9 @@
 
 
 
-  <h5 id="parsing-main-intabletext"><span class="secno">8.2.5.13 </span>The "<dfn title="insertion mode: in table text">in table text</dfn>" insertion mode</h5>
+  <h6 id="parsing-main-intabletext"><span class="secno">8.2.5.4.10 </span>The "<dfn title="insertion mode: in table text">in table text</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-intabletext" title="insertion
-  mode: in table text">in table text</a>", tokens must be handled
-  as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intabletext" title="insertion mode: in table text">in table text</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
    <dd>
@@ -61007,10 +61021,9 @@
 
    </dd>
 
-  </dl><h5 id="parsing-main-incaption"><span class="secno">8.2.5.14 </span>The "<dfn title="insertion mode: in caption">in caption</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-incaption"><span class="secno">8.2.5.4.11 </span>The "<dfn title="insertion mode: in caption">in caption</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-incaption" title="insertion
-  mode: in caption">in caption</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-incaption" title="insertion mode: in caption">in caption</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>An end tag whose tag name is "caption"</dt>
    <dd>
@@ -61065,10 +61078,9 @@
     mode</a>.</p>
    </dd>
 
-  </dl><h5 id="parsing-main-incolgroup"><span class="secno">8.2.5.15 </span>The "<dfn title="insertion mode: in column group">in column group</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-incolgroup"><span class="secno">8.2.5.4.12 </span>The "<dfn title="insertion mode: in column group">in column group</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-incolgroup" title="insertion
-  mode: in column group">in column group</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-incolgroup" title="insertion mode: in column group">in column group</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
    TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
@@ -61152,10 +61164,9 @@
 
    </dd>
 
-  </dl><h5 id="parsing-main-intbody"><span class="secno">8.2.5.16 </span>The "<dfn title="insertion mode: in table body">in table body</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-intbody"><span class="secno">8.2.5.4.13 </span>The "<dfn title="insertion mode: in table body">in table body</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-intbody" title="insertion
-  mode: in table body">in table body</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intbody" title="insertion mode: in table body">in table body</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A start tag whose tag name is "tr"</dt>
    <dd>
@@ -61241,10 +61252,9 @@
   case</a>.</p>
 
 
-  <h5 id="parsing-main-intr"><span class="secno">8.2.5.17 </span>The "<dfn title="insertion mode: in row">in row</dfn>" insertion mode</h5>
+  <h6 id="parsing-main-intr"><span class="secno">8.2.5.4.14 </span>The "<dfn title="insertion mode: in row">in row</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-intr" title="insertion
-  mode: in row">in row</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intr" title="insertion mode: in row">in row</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A start tag whose tag name is one of: "th", "td"</dt>
    <dd>
@@ -61332,10 +61342,9 @@
   case</a>.</p>
 
 
-  <h5 id="parsing-main-intd"><span class="secno">8.2.5.18 </span>The "<dfn title="insertion mode: in cell">in cell</dfn>" insertion mode</h5>
+  <h6 id="parsing-main-intd"><span class="secno">8.2.5.4.15 </span>The "<dfn title="insertion mode: in cell">in cell</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-intd" title="insertion
-  mode: in cell">in cell</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intd" title="insertion mode: in cell">in cell</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>An end tag whose tag name is one of: "td", "th"</dt>
    <dd>
@@ -61426,10 +61435,9 @@
   cell</a> algorithm is invoked.</p>
 
 
-  <h5 id="parsing-main-inselect"><span class="secno">8.2.5.19 </span>The "<dfn title="insertion mode: in select">in select</dfn>" insertion mode</h5>
+  <h6 id="parsing-main-inselect"><span class="secno">8.2.5.4.16 </span>The "<dfn title="insertion mode: in select">in select</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inselect" title="insertion
-  mode: in select">in select</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inselect" title="insertion mode: in select">in select</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
    <dd>
@@ -61577,10 +61585,9 @@
     <p><a href="#parse-error">Parse error</a>. Ignore the token.</p>
    </dd>
 
-  </dl><h5 id="parsing-main-inselectintable"><span class="secno">8.2.5.20 </span>The "<dfn title="insertion mode: in select in table">in select in table</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-inselectintable"><span class="secno">8.2.5.4.17 </span>The "<dfn title="insertion mode: in select in table">in select in table</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inselectintable" title="insertion
-  mode: in select in table">in select in table</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inselectintable" title="insertion mode: in select in table">in select in table</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A start tag whose tag name is one of: "caption", "table",
    "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
@@ -61609,275 +61616,9 @@
     mode</a>.</p>
    </dd>
 
-  </dl><h5 id="parsing-main-inforeign"><span class="secno">8.2.5.21 </span>The "<dfn title="insertion mode: in foreign content">in foreign content</dfn>" insertion mode</h5>
-
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inforeign" title="insertion
-  mode: in foreign content">in foreign content</a>", tokens must be
-  handled as follows:</p>
-
-  <dl class="switch"><dt>Any token, if the <a href="#current-node">current node</a> is an element in the <a href="#html-namespace-0">HTML 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 a <a href="#mathml-text-integration-point">MathML text integration point</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 <a href="#html-integration-point">HTML integration point</a></dt>
-   <dt>A character token, if the <a href="#current-node">current node</a> is an <a href="#html-integration-point">HTML integration point</a></dt>
-   <dt>An end-of-file token</dt>
-   <dd>
-
-    <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>
-
-     <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>
-
-    </ol></dd>
-
-   <dt>A character token that is U+0000 NULL</dt>
-   <dd>
-
-    <p><a href="#parse-error">Parse error</a>. <a href="#insert-a-character" title="insert a
-    character">Insert a U+FFFD REPLACEMENT CHARACTER character</a>
-    into the <a href="#current-node">current node</a>.</p>
-
-   </dd>
-
-   <dt>A character token that is one of U+0009 CHARACTER TABULATION,
-   U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE
-   RETURN (CR), or U+0020 SPACE</dt>
-   <dd>
-
-    <p><a href="#insert-a-character" title="insert a character">Insert the token's
-    character</a> into the <a href="#current-node">current node</a>.</p>
-
-   </dd>
-
-   <dt>Any other character token</dt>
-   <dd>
-
-    <p><a href="#insert-a-character" title="insert a character">Insert the token's
-    character</a> into the <a href="#current-node">current node</a>.</p>
-
-    <p>Set the <a href="#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
-
-   </dd>
-
-   <dt>A comment token</dt>
-   <dd>
-    <p>Append a <code><a href="#comment-0">Comment</a></code> node to the <a href="#current-node">current
-    node</a> with the <code title="">data</code> attribute set to
-    the data given in the comment token.</p>
-   </dd>
-
-   <dt>A DOCTYPE token</dt>
-   <dd>
-    <p><a href="#parse-error">Parse error</a>. Ignore the token.</p>
-   </dd>
-
-   <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",
-   "blockquote", "body"<!--by inspection-->, "br", "center", "code",
-   "dd", "div", "dl", "dt"<!-- so that dd and dt can be handled
-   uniformly throughout the parser -->, "em", "embed", "h1", "h2",
-   "h3", "h4"<!--for completeness-->, "h5", "h6"<!--for
-   completeness-->, "head"<!--by inspection-->, "hr", "i", "img",
-   "li", "listing"<!-- so that pre and listing can be handled
-   uniformly throughout the parser -->, "menu", "meta", "nobr",
-   "ol"<!-- so that dl, ul, and ol can be handled uniformly throughout
-   the parser -->, "p", "pre", "ruby", "s", <!--"script",--> "small",
-   "span", "strong", "strike"<!-- so that s and strike can be handled
-   uniformly throughout the parser -->, <!--"style",--> "sub", "sup",
-   "table"<!--by inspection-->, "tt", "u", "ul", "var"</dt> <!-- this
-   list was determined empirically by studying over 6,000,000,000
-   pages that were specifically not XML pages -->
-   <dt>A start tag whose tag name is "font", if the token has any
-   attributes named "color", "face", or "size"</dt> <!-- the
-   attributes here are required so that SVG <font> will go through as
-   SVG but legacy <font>s won't -->
-
-   <dd>
-
-    <p><a href="#parse-error">Parse error</a>.</p>
-
-    <p>Pop an element from the <a href="#stack-of-open-elements">stack of open elements</a>,
-    and then keep popping more elements from the <a href="#stack-of-open-elements">stack of open
-    elements</a> until the <a href="#current-node">current node</a> is a
-    <a href="#mathml-text-integration-point">MathML text integration point</a>, an <a href="#html-integration-point">HTML
-    integration point</a>, or an element in the <a href="#html-namespace-0">HTML
-    namespace</a>.</p>
-
-    <p>Then, <a href="#reset-the-insertion-mode-appropriately">reset the insertion mode appropriately</a> and
-    reprocess the token.</p>
-
-   </dd>
-
-   <dt>Any other start tag</dt>
-   <dd>
-
-    <p>If the <a href="#current-node">current node</a> is an element in the
-    <a href="#mathml-namespace">MathML namespace</a>, <a href="#adjust-mathml-attributes">adjust MathML
-    attributes</a> for the token. (This fixes the case of MathML
-    attributes that are not all lowercase.)</p>
-
-    <p>If the <a href="#current-node">current node</a> is an element in the <a href="#svg-namespace">SVG
-    namespace</a>, and the token's tag name is one of the ones in
-    the first column of the following table, change the tag name to
-    the name given in the corresponding cell in the second
-    column. (This fixes the case of SVG elements that are not all
-    lowercase.)</p>
-
-    <table><thead><tr><th> Tag name <th> Element name
-     <tbody><tr><td> <code title="">altglyph</code> <td> <code title="">altGlyph</code>
-      <tr><td> <code title="">altglyphdef</code> <td> <code title="">altGlyphDef</code>
-      <tr><td> <code title="">altglyphitem</code> <td> <code title="">altGlyphItem</code>
-      <tr><td> <code title="">animatecolor</code> <td> <code title="">animateColor</code>
-      <tr><td> <code title="">animatemotion</code> <td> <code title="">animateMotion</code>
-      <tr><td> <code title="">animatetransform</code> <td> <code title="">animateTransform</code>
-      <tr><td> <code title="">clippath</code> <td> <code title="">clipPath</code>
-      <tr><td> <code title="">feblend</code> <td> <code title="">feBlend</code>
-      <tr><td> <code title="">fecolormatrix</code> <td> <code title="">feColorMatrix</code>
-      <tr><td> <code title="">fecomponenttransfer</code> <td> <code title="">feComponentTransfer</code>
-      <tr><td> <code title="">fecomposite</code> <td> <code title="">feComposite</code>
-      <tr><td> <code title="">feconvolvematrix</code> <td> <code title="">feConvolveMatrix</code>
-      <tr><td> <code title="">fediffuselighting</code> <td> <code title="">feDiffuseLighting</code>
-      <tr><td> <code title="">fedisplacementmap</code> <td> <code title="">feDisplacementMap</code>
-      <tr><td> <code title="">fedistantlight</code> <td> <code title="">feDistantLight</code>
-      <tr><td> <code title="">feflood</code> <td> <code title="">feFlood</code>
-      <tr><td> <code title="">fefunca</code> <td> <code title="">feFuncA</code>
-      <tr><td> <code title="">fefuncb</code> <td> <code title="">feFuncB</code>
-      <tr><td> <code title="">fefuncg</code> <td> <code title="">feFuncG</code>
-      <tr><td> <code title="">fefuncr</code> <td> <code title="">feFuncR</code>
-      <tr><td> <code title="">fegaussianblur</code> <td> <code title="">feGaussianBlur</code>
-      <tr><td> <code title="">feimage</code> <td> <code title="">feImage</code>
-      <tr><td> <code title="">femerge</code> <td> <code title="">feMerge</code>
-      <tr><td> <code title="">femergenode</code> <td> <code title="">feMergeNode</code>
-      <tr><td> <code title="">femorphology</code> <td> <code title="">feMorphology</code>
-      <tr><td> <code title="">feoffset</code> <td> <code title="">feOffset</code>
-      <tr><td> <code title="">fepointlight</code> <td> <code title="">fePointLight</code>
-      <tr><td> <code title="">fespecularlighting</code> <td> <code title="">feSpecularLighting</code>
-      <tr><td> <code title="">fespotlight</code> <td> <code title="">feSpotLight</code>
-      <tr><td> <code title="">fetile</code> <td> <code title="">feTile</code>
-      <tr><td> <code title="">feturbulence</code> <td> <code title="">feTurbulence</code>
-      <tr><td> <code title="">foreignobject</code> <td> <code title="">foreignObject</code>
-      <tr><td> <code title="">glyphref</code> <td> <code title="">glyphRef</code>
-      <tr><td> <code title="">lineargradient</code> <td> <code title="">linearGradient</code>
-      <tr><td> <code title="">radialgradient</code> <td> <code title="">radialGradient</code>
-      <!--<tr> <td> <code title="">solidcolor</code> <td> <code title="">solidColor</code> (SVG 1.2)-->
-      <tr><td> <code title="">textpath</code> <td> <code title="">textPath</code>
-    </table><p>If the <a href="#current-node">current node</a> is an element in the <a href="#svg-namespace">SVG
-    namespace</a>, <a href="#adjust-svg-attributes">adjust SVG attributes</a> for the
-    token. (This fixes the case of SVG attributes that are not all
-    lowercase.)</p>
-
-    <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
-    fixes the use of namespaced attributes, in particular XLink in
-    SVG.)</p>
-
-    <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
-    same namespace as the <a href="#current-node">current node</a>.</p>
-
-    <p>If the token has its <i>self-closing flag</i> set, pop the
-    <a href="#current-node">current node</a> off the <a href="#stack-of-open-elements">stack of open
-    elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
-    flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
-
-   </dd>
-
-   <dt id="scriptForeignEndTag">An end tag whose tag name is "script", if the <a href="#current-node">current node</a> is a <code title="">script</code> element in the <a href="#svg-namespace">SVG namespace</a></dt>
-   <dd>
-
-    <p>Pop the <a href="#current-node">current node</a> off the <a href="#stack-of-open-elements">stack of open
-    elements</a>.</p>
-
-    <p>Let the <var title="">old insertion point</var> have the
-    same value as the current <a href="#insertion-point">insertion point</a>. Let
-    the <a href="#insertion-point">insertion point</a> be just before the <a href="#next-input-character">next
-    input character</a>.</p>
-
-    <p>Increment the parser's <a href="#script-nesting-level">script nesting level</a> by
-    one. Set the <a href="#parser-pause-flag">parser pause flag</a> to true.</p>
-
-    <p><a href="http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing">Process
-    the <code title="">script</code> element</a> according to the SVG
-    rules, if the user agent supports SVG. <a href="#refsSVG">[SVG]</a></p>
-
-    <p class="note">Even if this causes <a href="#dom-document-write" title="dom-document-write">new characters to be inserted into the
-    tokenizer</a>, the parser will not be executed reentrantly,
-    since the <a href="#parser-pause-flag">parser pause flag</a> is true.</p>
-
-    <p>Decrement the parser's <a href="#script-nesting-level">script nesting level</a> by
-    one. If the parser's <a href="#script-nesting-level">script nesting level</a> is zero,
-    then set the <a href="#parser-pause-flag">parser pause flag</a> to false.</p>
-
-    <p>Let the <a href="#insertion-point">insertion point</a> have the value of the <var title="">old insertion point</var>. (In other words, restore the
-    <a href="#insertion-point">insertion point</a> to its previous value. This value
-    might be the "undefined" value.)</p>
-
-   </dd>
-
-   <dt>Any other end tag</dt>
-
-   <dd>
-
-    <p>Run these steps:</p>
-
-    <ol><li><p>Initialize <var title="">node</var> to be the <a href="#current-node">current
-     node</a> (the bottommost node of the stack).</li>
-
-     <li><p>If <var title="">node</var> is not an element with the
-     same tag name as the token, then this is a <a href="#parse-error">parse
-     error</a>.</li>
-
-     <li><p><i>Loop</i>: If <var title="">node</var>'s tag name,
-     <a href="#converted-to-ascii-lowercase">converted to ASCII lowercase</a>, is the same as as the
-     tag name of the token, pop elements from the <a href="#stack-of-open-elements">stack of open
-     elements</a> until <var title="">node</var> has been popped
-     from the stack, and then jump to the last step of this list of
-     steps.</li>
-
-     <li><p>Set <var title="">node</var> to the previous entry in the
-     <a href="#stack-of-open-elements">stack of open elements</a>.</li>
-
-     <li><p>If <var title="">node</var> is not an element in the
-     <a href="#html-namespace-0">HTML namespace</a>, return to the step labeled
-     <i>loop</i>.</li>
-
-     <li><p>Otherwise, 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>
-
-     <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
-     appropriately</a>.</li>
-
-    </ol></dd>
-
-  </dl><p>The <a href="#current-node">current node</a> is a <dfn id="mathml-text-integration-point">MathML text
-  integration point</dfn> if it is one of the following elements:</p>
-
-  <ul class="brief"><li>An <code title="">mi</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
-   <li>An <code title="">mo</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
-   <li>An <code title="">mn</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
-   <li>An <code title="">ms</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
-   <li>An <code title="">mtext</code> element in the <a href="#mathml-namespace">MathML namespace</a></li>
-  </ul><p>The <a href="#current-node">current node</a> is an <dfn id="html-integration-point">HTML
-  integration point</dfn> if it is one of the following elements:</p>
-
-  <ul class="brief"><li>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>"</li>
-   <li>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>"</li>
-   <li>A <code title="">foreignObject</code> element in the <a href="#svg-namespace">SVG namespace</a></li>
-   <li>A <code title="">desc</code> element in the <a href="#svg-namespace">SVG namespace</a></li>
-   <li>A <code title="">title</code> element in the <a href="#svg-namespace">SVG namespace</a></li>
-  </ul><h5 id="parsing-main-afterbody"><span class="secno">8.2.5.22 </span>The "<dfn title="insertion mode: after body">after body</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-afterbody"><span class="secno">8.2.5.4.18 </span>The "<dfn title="insertion mode: after body">after body</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-afterbody" title="insertion
-  mode: after body">after body</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-afterbody" title="insertion mode: after body">after body</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
    TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
@@ -61932,10 +61673,9 @@
 
    </dd>
 
-  </dl><h5 id="parsing-main-inframeset"><span class="secno">8.2.5.23 </span>The "<dfn title="insertion mode: in frameset">in frameset</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-inframeset"><span class="secno">8.2.5.4.19 </span>The "<dfn title="insertion mode: in frameset">in frameset</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-inframeset" title="insertion
-  mode: in frameset">in frameset</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inframeset" title="insertion mode: in frameset">in frameset</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
    TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
@@ -62025,10 +61765,9 @@
     <p><a href="#parse-error">Parse error</a>. Ignore the token.</p>
    </dd>
 
-  </dl><h5 id="parsing-main-afterframeset"><span class="secno">8.2.5.24 </span>The "<dfn title="insertion mode: after frameset">after frameset</dfn>" insertion mode</h5>
+  </dl><h6 id="parsing-main-afterframeset"><span class="secno">8.2.5.4.20 </span>The "<dfn title="insertion mode: after frameset">after frameset</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#parsing-main-afterframeset" title="insertion
-  mode: after frameset">after frameset</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#parsing-main-afterframeset" title="insertion mode: after frameset">after frameset</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <!-- due to rules in the "in frameset" mode, this can't be entered in the fragment case -->
   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
@@ -62079,10 +61818,9 @@
     <p><a href="#parse-error">Parse error</a>. Ignore the token.</p>
    </dd>
 
-  </dl><h5 id="the-after-after-body-insertion-mode"><span class="secno">8.2.5.25 </span>The "<dfn title="insertion mode: after after body">after after body</dfn>" insertion mode</h5>
+  </dl><h6 id="the-after-after-body-insertion-mode"><span class="secno">8.2.5.4.21 </span>The "<dfn title="insertion mode: after after body">after after body</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#the-after-after-body-insertion-mode" title="insertion
-  mode: after after body">after after body</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#the-after-after-body-insertion-mode" title="insertion mode: after after body">after after body</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A comment token</dt>
    <dd>
@@ -62113,10 +61851,9 @@
     reprocess the token.</p>
    </dd>
 
-  </dl><h5 id="the-after-after-frameset-insertion-mode"><span class="secno">8.2.5.26 </span>The "<dfn title="insertion mode: after after frameset">after after frameset</dfn>" insertion mode</h5>
+  </dl><h6 id="the-after-after-frameset-insertion-mode"><span class="secno">8.2.5.4.22 </span>The "<dfn title="insertion mode: after after frameset">after after frameset</dfn>" insertion mode</h6>
 
-  <p>When the <a href="#insertion-mode">insertion mode</a> is "<a href="#the-after-after-frameset-insertion-mode" title="insertion
-  mode: after after frameset">after after frameset</a>", tokens must be handled as follows:</p>
+  <p>When the user agent is to apply the rules for the "<a href="#the-after-after-frameset-insertion-mode" title="insertion mode: after after frameset">after after frameset</a>" <a href="#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
 
   <dl class="switch"><dt>A comment token</dt>
    <dd>
@@ -62151,6 +61888,223 @@
     <p><a href="#parse-error">Parse error</a>. Ignore the token.</p>
    </dd>
 
+  </dl><h5 id="parsing-main-inforeign"><span class="secno">8.2.5.5 </span>The rules for parsing tokens <dfn title="insertion mode: in foreign content">in foreign content</dfn></h5>
+
+  <p>When the user agent is to apply the rules for parsing tokens in foreign content, the user agent must handle the token as follows:</p>
+
+  <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
+   <dd>
+
+    <p><a href="#parse-error">Parse error</a>. <a href="#insert-a-character" title="insert a
+    character">Insert a U+FFFD REPLACEMENT CHARACTER character</a>
+    into the <a href="#current-node">current node</a>.</p>
+
+   </dd>
+
+   <dt>A character token that is one of U+0009 CHARACTER TABULATION,
+   U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE
+   RETURN (CR), or U+0020 SPACE</dt>
+   <dd>
+
+    <p><a href="#insert-a-character" title="insert a character">Insert the token's
+    character</a> into the <a href="#current-node">current node</a>.</p>
+
+   </dd>
+
+   <dt>Any other character token</dt>
+   <dd>
+
+    <p><a href="#insert-a-character" title="insert a character">Insert the token's
+    character</a> into the <a href="#current-node">current node</a>.</p>
+
+    <p>Set the <a href="#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
+
+   </dd>
+
+   <dt>A comment token</dt>
+   <dd>
+    <p>Append a <code><a href="#comment-0">Comment</a></code> node to the <a href="#current-node">current
+    node</a> with the <code title="">data</code> attribute set to
+    the data given in the comment token.</p>
+   </dd>
+
+   <dt>A DOCTYPE token</dt>
+   <dd>
+    <p><a href="#parse-error">Parse error</a>. Ignore the token.</p>
+   </dd>
+
+   <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",
+   "blockquote", "body"<!--by inspection-->, "br", "center", "code",
+   "dd", "div", "dl", "dt"<!-- so that dd and dt can be handled
+   uniformly throughout the parser -->, "em", "embed", "h1", "h2",
+   "h3", "h4"<!--for completeness-->, "h5", "h6"<!--for
+   completeness-->, "head"<!--by inspection-->, "hr", "i", "img",
+   "li", "listing"<!-- so that pre and listing can be handled
+   uniformly throughout the parser -->, "menu", "meta", "nobr",
+   "ol"<!-- so that dl, ul, and ol can be handled uniformly throughout
+   the parser -->, "p", "pre", "ruby", "s", <!--"script",--> "small",
+   "span", "strong", "strike"<!-- so that s and strike can be handled
+   uniformly throughout the parser -->, <!--"style",--> "sub", "sup",
+   "table"<!--by inspection-->, "tt", "u", "ul", "var"</dt> <!-- this
+   list was determined empirically by studying over 6,000,000,000
+   pages that were specifically not XML pages -->
+   <dt>A start tag whose tag name is "font", if the token has any
+   attributes named "color", "face", or "size"</dt> <!-- the
+   attributes here are required so that SVG <font> will go through as
+   SVG but legacy <font>s won't -->
+
+   <dd>
+
+    <p><a href="#parse-error">Parse error</a>.</p>
+
+    <p>Pop an element from the <a href="#stack-of-open-elements">stack of open elements</a>,
+    and then keep popping more elements from the <a href="#stack-of-open-elements">stack of open
+    elements</a> until the <a href="#current-node">current node</a> is a
+    <a href="#mathml-text-integration-point">MathML text integration point</a>, an <a href="#html-integration-point">HTML
+    integration point</a>, or an element in the <a href="#html-namespace-0">HTML
+    namespace</a>.</p>
+
+    <p>Then, reprocess the token.</p>
+
+   </dd>
+
+   <dt>Any other start tag</dt>
+   <dd>
+
+    <p>If the <a href="#current-node">current node</a> is an element in the
+    <a href="#mathml-namespace">MathML namespace</a>, <a href="#adjust-mathml-attributes">adjust MathML
+    attributes</a> for the token. (This fixes the case of MathML
+    attributes that are not all lowercase.)</p>
+
+    <p>If the <a href="#current-node">current node</a> is an element in the <a href="#svg-namespace">SVG
+    namespace</a>, and the token's tag name is one of the ones in
+    the first column of the following table, change the tag name to
+    the name given in the corresponding cell in the second
+    column. (This fixes the case of SVG elements that are not all
+    lowercase.)</p>
+
+    <table><thead><tr><th> Tag name <th> Element name
+     <tbody><tr><td> <code title="">altglyph</code> <td> <code title="">altGlyph</code>
+      <tr><td> <code title="">altglyphdef</code> <td> <code title="">altGlyphDef</code>
+      <tr><td> <code title="">altglyphitem</code> <td> <code title="">altGlyphItem</code>
+      <tr><td> <code title="">animatecolor</code> <td> <code title="">animateColor</code>
+      <tr><td> <code title="">animatemotion</code> <td> <code title="">animateMotion</code>
+      <tr><td> <code title="">animatetransform</code> <td> <code title="">animateTransform</code>
+      <tr><td> <code title="">clippath</code> <td> <code title="">clipPath</code>
+      <tr><td> <code title="">feblend</code> <td> <code title="">feBlend</code>
+      <tr><td> <code title="">fecolormatrix</code> <td> <code title="">feColorMatrix</code>
+      <tr><td> <code title="">fecomponenttransfer</code> <td> <code title="">feComponentTransfer</code>
+      <tr><td> <code title="">fecomposite</code> <td> <code title="">feComposite</code>
+      <tr><td> <code title="">feconvolvematrix</code> <td> <code title="">feConvolveMatrix</code>
+      <tr><td> <code title="">fediffuselighting</code> <td> <code title="">feDiffuseLighting</code>
+      <tr><td> <code title="">fedisplacementmap</code> <td> <code title="">feDisplacementMap</code>
+      <tr><td> <code title="">fedistantlight</code> <td> <code title="">feDistantLight</code>
+      <tr><td> <code title="">feflood</code> <td> <code title="">feFlood</code>
+      <tr><td> <code title="">fefunca</code> <td> <code title="">feFuncA</code>
+      <tr><td> <code title="">fefuncb</code> <td> <code title="">feFuncB</code>
+      <tr><td> <code title="">fefuncg</code> <td> <code title="">feFuncG</code>
+      <tr><td> <code title="">fefuncr</code> <td> <code title="">feFuncR</code>
+      <tr><td> <code title="">fegaussianblur</code> <td> <code title="">feGaussianBlur</code>
+      <tr><td> <code title="">feimage</code> <td> <code title="">feImage</code>
+      <tr><td> <code title="">femerge</code> <td> <code title="">feMerge</code>
+      <tr><td> <code title="">femergenode</code> <td> <code title="">feMergeNode</code>
+      <tr><td> <code title="">femorphology</code> <td> <code title="">feMorphology</code>
+      <tr><td> <code title="">feoffset</code> <td> <code title="">feOffset</code>
+      <tr><td> <code title="">fepointlight</code> <td> <code title="">fePointLight</code>
+      <tr><td> <code title="">fespecularlighting</code> <td> <code title="">feSpecularLighting</code>
+      <tr><td> <code title="">fespotlight</code> <td> <code title="">feSpotLight</code>
+      <tr><td> <code title="">fetile</code> <td> <code title="">feTile</code>
+      <tr><td> <code title="">feturbulence</code> <td> <code title="">feTurbulence</code>
+      <tr><td> <code title="">foreignobject</code> <td> <code title="">foreignObject</code>
+      <tr><td> <code title="">glyphref</code> <td> <code title="">glyphRef</code>
+      <tr><td> <code title="">lineargradient</code> <td> <code title="">linearGradient</code>
+      <tr><td> <code title="">radialgradient</code> <td> <code title="">radialGradient</code>
+      <!--<tr> <td> <code title="">solidcolor</code> <td> <code title="">solidColor</code> (SVG 1.2)-->
+      <tr><td> <code title="">textpath</code> <td> <code title="">textPath</code>
+    </table><p>If the <a href="#current-node">current node</a> is an element in the <a href="#svg-namespace">SVG
+    namespace</a>, <a href="#adjust-svg-attributes">adjust SVG attributes</a> for the
+    token. (This fixes the case of SVG attributes that are not all
+    lowercase.)</p>
+
+    <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
+    fixes the use of namespaced attributes, in particular XLink in
+    SVG.)</p>
+
+    <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
+    same namespace as the <a href="#current-node">current node</a>.</p>
+
+    <p>If the token has its <i>self-closing flag</i> set, pop the
+    <a href="#current-node">current node</a> off the <a href="#stack-of-open-elements">stack of open
+    elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
+    flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
+
+   </dd>
+
+   <dt id="scriptForeignEndTag">An end tag whose tag name is "script", if the <a href="#current-node">current node</a> is a <code title="">script</code> element in the <a href="#svg-namespace">SVG namespace</a></dt>
+   <dd>
+
+    <p>Pop the <a href="#current-node">current node</a> off the <a href="#stack-of-open-elements">stack of open
+    elements</a>.</p>
+
+    <p>Let the <var title="">old insertion point</var> have the
+    same value as the current <a href="#insertion-point">insertion point</a>. Let
+    the <a href="#insertion-point">insertion point</a> be just before the <a href="#next-input-character">next
+    input character</a>.</p>
+
+    <p>Increment the parser's <a href="#script-nesting-level">script nesting level</a> by
+    one. Set the <a href="#parser-pause-flag">parser pause flag</a> to true.</p>
+
+    <p><a href="http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing">Process
+    the <code title="">script</code> element</a> according to the SVG
+    rules, if the user agent supports SVG. <a href="#refsSVG">[SVG]</a></p>
+
+    <p class="note">Even if this causes <a href="#dom-document-write" title="dom-document-write">new characters to be inserted into the
+    tokenizer</a>, the parser will not be executed reentrantly,
+    since the <a href="#parser-pause-flag">parser pause flag</a> is true.</p>
+
+    <p>Decrement the parser's <a href="#script-nesting-level">script nesting level</a> by
+    one. If the parser's <a href="#script-nesting-level">script nesting level</a> is zero,
+    then set the <a href="#parser-pause-flag">parser pause flag</a> to false.</p>
+
+    <p>Let the <a href="#insertion-point">insertion point</a> have the value of the <var title="">old insertion point</var>. (In other words, restore the
+    <a href="#insertion-point">insertion point</a> to its previous value. This value
+    might be the "undefined" value.)</p>
+
+   </dd>
+
+   <dt>Any other end tag</dt>
+
+   <dd>
+
+    <p>Run these steps:</p>
+
+    <ol><li><p>Initialize <var title="">node</var> to be the <a href="#current-node">current
+     node</a> (the bottommost node of the stack).</li>
+
+     <li><p>If <var title="">node</var> is not an element with the
+     same tag name as the token, then this is a <a href="#parse-error">parse
+     error</a>.</li>
+
+     <li><p><i>Loop</i>: If <var title="">node</var>'s tag name,
+     <a href="#converted-to-ascii-lowercase">converted to ASCII lowercase</a>, is the same as as the
+     tag name of the token, pop elements from the <a href="#stack-of-open-elements">stack of open
+     elements</a> until <var title="">node</var> has been popped
+     from the stack, and then jump to the last step of this list of
+     steps.</li>
+
+     <li><p>Set <var title="">node</var> to the previous entry in the
+     <a href="#stack-of-open-elements">stack of open elements</a>.</li>
+
+     <li><p>If <var title="">node</var> is not an element in the
+     <a href="#html-namespace-0">HTML namespace</a>, return to the step labeled
+     <i>loop</i>.</li>
+
+     <li><p>Otherwise, process the token according to the rules given
+     in the section corresponding to the current <a href="#insertion-mode">insertion
+     mode</a> in HTML content.</li>
+
+    </ol></dd>
+
   </dl></div><div class="impl">
 
   <h4 id="the-end"><span class="secno">8.2.6 </span>The end</h4>
Received on Monday, 28 February 2011 23:57:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 28 February 2011 23:57:56 GMT