[html5] r8002 - [e] (0) Remove the remaining 'act as if' cases. This _should_ be an entirely edi [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Jul 1 14:49:24 PDT 2013


Author: ianh
Date: 2013-07-01 14:49:22 -0700 (Mon, 01 Jul 2013)
New Revision: 8002

Modified:
   complete.html
   index
   source
Log:
[e] (0) Remove the remaining 'act as if' cases. This _should_ be an entirely editorial fix, but reviews are definitely encouraged...
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=22322
Affected topics: HTML Syntax and Parsing

Modified: complete.html
===================================================================
--- complete.html	2013-07-01 21:19:49 UTC (rev 8001)
+++ complete.html	2013-07-01 21:49:22 UTC (rev 8002)
@@ -88823,8 +88823,7 @@
   <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>
 
-  <hr><p>As each token is emitted from the tokenizer, and when the specification says that a user agent
-  is to <dfn id=act-as-if-a-token-had-been-seen>act as if a token had been seen</dfn>, the user agent must follow the appropriate steps
+  <hr><p>As each token is emitted from the tokenizer, the user agent must follow the appropriate steps
   from the following list, known as the <dfn id=tree-construction-dispatcher>tree construction dispatcher</dfn>:</p>
 
   <dl class=switch><dt>If there is no <a href=#adjusted-current-node>adjusted current node</a></dt>
@@ -90612,10 +90611,11 @@
     contains an element whose tag name is "a" between the end of
     the list and the last marker on the list (or the start of the
     list if there is no marker on the list), then this is a
-    <a href=#parse-error>parse error</a>; act as if an end tag with the tag
-    name "a" had been seen, then remove that element from the
+    <a href=#parse-error>parse error</a>; run the <a href=#adoption-agency-algorithm>adoption agency
+    algorithm</a> for the tag name "a", then remove that element from the
     <a href=#list-of-active-formatting-elements>list of active formatting elements</a> and the
-    <a href=#stack-of-open-elements>stack of open elements</a> if the end tag didn't
+    <a href=#stack-of-open-elements>stack of open elements</a> if the <a href=#adoption-agency-algorithm>adoption agency
+    algorithm</a> didn't
     already remove it (it might not have if the element is not
     <a href=#has-an-element-in-table-scope title="has an element in table scope">in table
     scope</a>).</p>
@@ -90662,8 +90662,8 @@
 
     <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an
     element in scope">has a <code>nobr</code> element in scope</a>,
-    then this is a <a href=#parse-error>parse error</a>; act as if an end tag with
-    the tag name "nobr" had been seen, then once again
+    then this is a <a href=#parse-error>parse error</a>; run the <a href=#adoption-agency-algorithm>adoption agency algorithm</a> for
+    the tag name "nobr", then once again
     <a href=#reconstruct-the-active-formatting-elements>reconstruct the active formatting elements</a>, if
     any.</p>
 
@@ -90678,160 +90678,8 @@
    "strike", "strong", "tt", "u"</dt>
    <dd>
 
-    <p>Run these steps:</p>
+    <p>Run the <a href=#adoption-agency-algorithm>adoption agency algorithm</a> for the token's tag name.</p>
 
-    <ol><li><p>Let <var title="">outer loop counter</var> be
-     zero.</li>
-
-     <li><p><i>Outer loop</i>: If <var title="">outer loop
-     counter</var> is greater than or equal to eight, then abort these
-     steps.</li>
-
-     <li><p>Increment <var title="">outer loop counter</var> by
-     one.</li>
-
-     <li>
-
-      <p>Let the <var title="">formatting element</var> be the last
-      element in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>
-      that:</p>
-
-      <ul><li>is between the end of the list and the last scope
-       marker in the list, if any, or the start of the list
-       otherwise, and</li>
-
-       <li>has the same tag name as the token.</li>
-
-      </ul><p>If there is no such node, then abort these steps and instead
-      act as described in the "any other end tag" entry below.</p>
-
-      <p>Otherwise, if there is such a node, but that node is not
-      in the <a href=#stack-of-open-elements>stack of open elements</a>, then this is a
-      <a href=#parse-error>parse error</a>; remove the element from the list,
-      and abort these steps.</p>
-
-      <p>Otherwise, if there is such a node, and that node is also in
-      the <a href=#stack-of-open-elements>stack of open elements</a>, but the element is not
-      <a href=#has-an-element-in-scope title="has an element in scope">in scope</a>, then this
-      is a <a href=#parse-error>parse error</a>; ignore the token, and abort these
-      steps.</p>
-
-      <p>Otherwise, there is a <var title="">formatting
-      element</var> and that element is in <a href=#stack-of-open-elements title="stack of
-      open elements">the stack</a> and is <a href=#has-an-element-in-scope title="has an
-      element in scope">in scope</a>. If the element is not the
-      <a href=#current-node>current node</a>, this is a <a href=#parse-error>parse
-      error</a>. In any case, proceed with the algorithm as
-      written in the following steps.</p>
-
-     </li>
-
-     <li><p>Let the <var title="">furthest block</var> be the topmost
-     node in the <a href=#stack-of-open-elements>stack of open elements</a> that is lower in
-     the stack than the <var title="">formatting element</var>, and is
-     an element in the <a href=#special>special</a> category. There might not
-     be one.</li>
-
-     <li><p>If there is no <var title="">furthest block</var>, then
-     the UA must first pop all the nodes from the bottom of the
-     <a href=#stack-of-open-elements>stack of open elements</a>, from the <a href=#current-node>current
-     node</a> up to and including the <var title="">formatting
-     element</var>, then remove the <var title="">formatting
-     element</var> from the <a href=#list-of-active-formatting-elements>list of active formatting
-     elements</a>, and finally abort these steps.</li>
-
-     <li><p>Let the <var title="">common ancestor</var> be the element
-     immediately above the <var title="">formatting element</var> in the
-     <a href=#stack-of-open-elements>stack of open elements</a>.</li>
-
-     <li><p>Let a bookmark note the position of the <var title="">formatting element</var> in the <a href=#list-of-active-formatting-elements>list of active
-     formatting elements</a> relative to the elements on either
-     side of it in the list.</li>
-
-     <li>
-
-      <p>Let <var title="">node</var> and <var title="">last node</var> be the <var title="">furthest block</var>. Follow these steps:</p>
-
-      <ol><li><p>Let <var title="">inner loop counter</var> be zero.</li>
-
-       <li><p><i>Inner loop</i>: If <var title="">inner loop counter</var> is greater than or equal
-       to three, then go to the next step in the overall algorithm.</li>
-
-       <li><p>Increment <var title="">inner loop counter</var> by one.</li>
-
-       <li>Let <var title="">node</var> be the element immediately
-       above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
-       elements</a>, or if <var title="">node</var> is no longer in
-       the <a href=#stack-of-open-elements>stack of open elements</a> (e.g. because it got
-       removed by the next step), the element that was immediately
-       above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
-       elements</a> before <var title="">node</var> was
-       removed.</li>
-
-       <li>If <var title="">node</var> is not in the <a href=#list-of-active-formatting-elements>list of
-       active formatting elements</a>, then remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open
-       elements</a> and then go back to the step labeled <i>inner
-       loop</i>.</li>
-
-       <li>Otherwise, if <var title="">node</var> is the <var title="">formatting element</var>, then go to the next step
-       in the overall algorithm.</li>
-
-       <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
-       element <var title="">node</var> was created, with <var title="">common ancestor</var> as the intended parent; replace the entry
-       for <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active
-       formatting elements</a> with an entry for the new element,
-       replace the entry for <var title="">node</var> in the
-       <a href=#stack-of-open-elements>stack of open elements</a> with an entry for the new
-       element, and let <var title="">node</var> be the new
-       element.</li>
-
-       <li>If <var title="">last node</var> is the <var title="">furthest block</var>, then move the aforementioned
-       bookmark to be immediately after the new <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
-       elements</a>.</li>
-
-       <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous
-       parent node if any.</li>
-
-       <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
-
-       <li>Return to the step labeled <i>inner loop</i>.</li>
-
-      </ol></li>
-
-     <li><p>Insert whatever <var title="">last node</var> ended up being in the previous step at the <a href=#appropriate-place-for-inserting-a-node>appropriate
-     place for inserting a node</a>, but using <var title="">common ancestor</var> as the <i>override target</i>.</li>
-
-     <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
-     <var title="">formatting element</var> was created, with <var title="">furthest
-     block</var> as the intended parent.</li>
-
-     <li><p>Take all of the child nodes of the <var title="">furthest
-     block</var> and append them to the element created in the last
-     step.</li>
-
-     <li><p>Append that new element to the <var title="">furthest
-     block</var>.</li>
-
-     <li><p>Remove the <var title="">formatting element</var> from the
-     <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and insert the
-     new element into the <a href=#list-of-active-formatting-elements>list of active formatting
-     elements</a> at the position of the aforementioned
-     bookmark.</li>
-
-     <li><p>Remove the <var title="">formatting element</var> from the
-     <a href=#stack-of-open-elements>stack of open elements</a>, and insert the new element
-     into the <a href=#stack-of-open-elements>stack of open elements</a> immediately below
-     the position of the <var title="">furthest block</var> in that
-     stack.</li>
-
-     <li><p>Jump back to the step labeled <i>outer loop</i>.</li>
-
-    </ol><p class=note>Because of the way this algorithm causes elements
-    to change parents, it has been dubbed the "adoption agency
-    algorithm" (in contrast with other possible algorithms for dealing
-    with misnested content, which included the "incest algorithm", the
-    "secret affair algorithm", and the "Heisenberg algorithm").</p>
-
    </dd>
 
    <dt>A start tag token whose tag name is one of: "applet",
@@ -91332,8 +91180,166 @@
    <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-p-element>p</a></code> element
    has been popped from the stack.</li>
 
-  </ol><h6 id=parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>
+  </ol><p>The <dfn id=adoption-agency-algorithm>adoption agency algorithm</dfn>, which takes as its only argument a tag name <var title="">subject</var> for which the algorithm is being run, consists of the following steps:</p>
 
+<!--CLEANUP-->
+  <ol><li><p>Let <var title="">outer loop counter</var> be
+   zero.</li>
+
+   <li><p><i>Outer loop</i>: If <var title="">outer loop
+   counter</var> is greater than or equal to eight, then abort these
+   steps.</li>
+
+   <li><p>Increment <var title="">outer loop counter</var> by
+   one.</li>
+
+   <li>
+
+    <p>Let the <var title="">formatting element</var> be the last
+    element in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>
+    that:</p>
+
+    <ul><li>is between the end of the list and the last scope
+     marker in the list, if any, or the start of the list
+     otherwise, and</li>
+
+     <li>has the tag name <var title="">subject</var>.</li>
+
+    </ul><p>If there is no such node, then abort these steps and instead
+    act as described in the "any other end tag" entry below.</p>
+
+    <p>Otherwise, if there is such a node, but that node is not
+    in the <a href=#stack-of-open-elements>stack of open elements</a>, then this is a
+    <a href=#parse-error>parse error</a>; remove the element from the list,
+    and abort these steps.</p>
+
+    <p>Otherwise, if there is such a node, and that node is also in
+    the <a href=#stack-of-open-elements>stack of open elements</a>, but the element is not
+    <a href=#has-an-element-in-scope title="has an element in scope">in scope</a>, then this
+    is a <a href=#parse-error>parse error</a>; abort these
+    steps.</p>
+
+    <p>Otherwise, there is a <var title="">formatting
+    element</var> and that element is in <a href=#stack-of-open-elements title="stack of
+    open elements">the stack</a> and is <a href=#has-an-element-in-scope title="has an
+    element in scope">in scope</a>. If the element is not the
+    <a href=#current-node>current node</a>, this is a <a href=#parse-error>parse
+    error</a>. In any case, proceed with the algorithm as
+    written in the following steps.</p>
+
+   </li>
+
+   <li><p>Let the <var title="">furthest block</var> be the topmost
+   node in the <a href=#stack-of-open-elements>stack of open elements</a> that is lower in
+   the stack than the <var title="">formatting element</var>, and is
+   an element in the <a href=#special>special</a> category. There might not
+   be one.</li>
+
+   <li><p>If there is no <var title="">furthest block</var>, then
+   the UA must first pop all the nodes from the bottom of the
+   <a href=#stack-of-open-elements>stack of open elements</a>, from the <a href=#current-node>current
+   node</a> up to and including the <var title="">formatting
+   element</var>, then remove the <var title="">formatting
+   element</var> from the <a href=#list-of-active-formatting-elements>list of active formatting
+   elements</a>, and finally abort these steps.</li>
+
+   <li><p>Let the <var title="">common ancestor</var> be the element
+   immediately above the <var title="">formatting element</var> in the
+   <a href=#stack-of-open-elements>stack of open elements</a>.</li>
+
+   <li><p>Let a bookmark note the position of the <var title="">formatting element</var> in the <a href=#list-of-active-formatting-elements>list of active
+   formatting elements</a> relative to the elements on either
+   side of it in the list.</li>
+
+   <li>
+
+    <p>Let <var title="">node</var> and <var title="">last node</var> be the <var title="">furthest block</var>. Follow these steps:</p>
+
+    <ol><li><p>Let <var title="">inner loop counter</var> be zero.</li>
+
+     <li><p><i>Inner loop</i>: If <var title="">inner loop counter</var> is greater than or equal
+     to three, then go to the next step in the overall algorithm.</li>
+
+     <li><p>Increment <var title="">inner loop counter</var> by one.</li>
+
+     <li>Let <var title="">node</var> be the element immediately
+     above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
+     elements</a>, or if <var title="">node</var> is no longer in
+     the <a href=#stack-of-open-elements>stack of open elements</a> (e.g. because it got
+     removed by the next step), the element that was immediately
+     above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
+     elements</a> before <var title="">node</var> was
+     removed.</li>
+
+     <li>If <var title="">node</var> is not in the <a href=#list-of-active-formatting-elements>list of
+     active formatting elements</a>, then remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open
+     elements</a> and then go back to the step labeled <i>inner
+     loop</i>.</li>
+
+     <li>Otherwise, if <var title="">node</var> is the <var title="">formatting element</var>, then go to the next step
+     in the overall algorithm.</li>
+
+     <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
+     element <var title="">node</var> was created, with <var title="">common ancestor</var> as the intended parent; replace the entry
+     for <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active
+     formatting elements</a> with an entry for the new element,
+     replace the entry for <var title="">node</var> in the
+     <a href=#stack-of-open-elements>stack of open elements</a> with an entry for the new
+     element, and let <var title="">node</var> be the new
+     element.</li>
+
+     <li>If <var title="">last node</var> is the <var title="">furthest block</var>, then move the aforementioned
+     bookmark to be immediately after the new <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
+     elements</a>.</li>
+
+     <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous
+     parent node if any.</li>
+
+     <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
+
+     <li>Return to the step labeled <i>inner loop</i>.</li>
+
+    </ol></li>
+
+   <li><p>Insert whatever <var title="">last node</var> ended up being in the previous step at the <a href=#appropriate-place-for-inserting-a-node>appropriate
+   place for inserting a node</a>, but using <var title="">common ancestor</var> as the <i>override target</i>.</li>
+
+   <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
+   <var title="">formatting element</var> was created, with <var title="">furthest
+   block</var> as the intended parent.</li>
+
+   <li><p>Take all of the child nodes of the <var title="">furthest
+   block</var> and append them to the element created in the last
+   step.</li>
+
+   <li><p>Append that new element to the <var title="">furthest
+   block</var>.</li>
+
+   <li><p>Remove the <var title="">formatting element</var> from the
+   <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and insert the
+   new element into the <a href=#list-of-active-formatting-elements>list of active formatting
+   elements</a> at the position of the aforementioned
+   bookmark.</li>
+
+   <li><p>Remove the <var title="">formatting element</var> from the
+   <a href=#stack-of-open-elements>stack of open elements</a>, and insert the new element
+   into the <a href=#stack-of-open-elements>stack of open elements</a> immediately below
+   the position of the <var title="">furthest block</var> in that
+   stack.</li>
+
+   <li><p>Jump back to the step labeled <i>outer loop</i>.</li>
+
+  </ol><p class=note>This algorithm's name, the "adoption agency algorithm", comes from the way it
+  causes elements to change parents, and is in contrast with other possible algorithms for dealing
+  with misnested content, which included the "incest algorithm", the "secret affair algorithm", and
+  the "Heisenberg algorithm".</p>
+
+
+
+
+
+  <h6 id=parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>
+
   <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>
@@ -93000,7 +93006,7 @@
      <dd>
 
       <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
-      flag</i></a>, and then act as if an end tag with the tag name "script" had been seen.</p>
+      flag</i></a>, and then act as described in the steps for a "script" end tag below.</p>
 
      </dd>
 

Modified: index
===================================================================
--- index	2013-07-01 21:19:49 UTC (rev 8001)
+++ index	2013-07-01 21:49:22 UTC (rev 8002)
@@ -88823,8 +88823,7 @@
   <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>
 
-  <hr><p>As each token is emitted from the tokenizer, and when the specification says that a user agent
-  is to <dfn id=act-as-if-a-token-had-been-seen>act as if a token had been seen</dfn>, the user agent must follow the appropriate steps
+  <hr><p>As each token is emitted from the tokenizer, the user agent must follow the appropriate steps
   from the following list, known as the <dfn id=tree-construction-dispatcher>tree construction dispatcher</dfn>:</p>
 
   <dl class=switch><dt>If there is no <a href=#adjusted-current-node>adjusted current node</a></dt>
@@ -90612,10 +90611,11 @@
     contains an element whose tag name is "a" between the end of
     the list and the last marker on the list (or the start of the
     list if there is no marker on the list), then this is a
-    <a href=#parse-error>parse error</a>; act as if an end tag with the tag
-    name "a" had been seen, then remove that element from the
+    <a href=#parse-error>parse error</a>; run the <a href=#adoption-agency-algorithm>adoption agency
+    algorithm</a> for the tag name "a", then remove that element from the
     <a href=#list-of-active-formatting-elements>list of active formatting elements</a> and the
-    <a href=#stack-of-open-elements>stack of open elements</a> if the end tag didn't
+    <a href=#stack-of-open-elements>stack of open elements</a> if the <a href=#adoption-agency-algorithm>adoption agency
+    algorithm</a> didn't
     already remove it (it might not have if the element is not
     <a href=#has-an-element-in-table-scope title="has an element in table scope">in table
     scope</a>).</p>
@@ -90662,8 +90662,8 @@
 
     <p>If the <a href=#stack-of-open-elements>stack of open elements</a> <a href=#has-an-element-in-scope title="has an
     element in scope">has a <code>nobr</code> element in scope</a>,
-    then this is a <a href=#parse-error>parse error</a>; act as if an end tag with
-    the tag name "nobr" had been seen, then once again
+    then this is a <a href=#parse-error>parse error</a>; run the <a href=#adoption-agency-algorithm>adoption agency algorithm</a> for
+    the tag name "nobr", then once again
     <a href=#reconstruct-the-active-formatting-elements>reconstruct the active formatting elements</a>, if
     any.</p>
 
@@ -90678,160 +90678,8 @@
    "strike", "strong", "tt", "u"</dt>
    <dd>
 
-    <p>Run these steps:</p>
+    <p>Run the <a href=#adoption-agency-algorithm>adoption agency algorithm</a> for the token's tag name.</p>
 
-    <ol><li><p>Let <var title="">outer loop counter</var> be
-     zero.</li>
-
-     <li><p><i>Outer loop</i>: If <var title="">outer loop
-     counter</var> is greater than or equal to eight, then abort these
-     steps.</li>
-
-     <li><p>Increment <var title="">outer loop counter</var> by
-     one.</li>
-
-     <li>
-
-      <p>Let the <var title="">formatting element</var> be the last
-      element in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>
-      that:</p>
-
-      <ul><li>is between the end of the list and the last scope
-       marker in the list, if any, or the start of the list
-       otherwise, and</li>
-
-       <li>has the same tag name as the token.</li>
-
-      </ul><p>If there is no such node, then abort these steps and instead
-      act as described in the "any other end tag" entry below.</p>
-
-      <p>Otherwise, if there is such a node, but that node is not
-      in the <a href=#stack-of-open-elements>stack of open elements</a>, then this is a
-      <a href=#parse-error>parse error</a>; remove the element from the list,
-      and abort these steps.</p>
-
-      <p>Otherwise, if there is such a node, and that node is also in
-      the <a href=#stack-of-open-elements>stack of open elements</a>, but the element is not
-      <a href=#has-an-element-in-scope title="has an element in scope">in scope</a>, then this
-      is a <a href=#parse-error>parse error</a>; ignore the token, and abort these
-      steps.</p>
-
-      <p>Otherwise, there is a <var title="">formatting
-      element</var> and that element is in <a href=#stack-of-open-elements title="stack of
-      open elements">the stack</a> and is <a href=#has-an-element-in-scope title="has an
-      element in scope">in scope</a>. If the element is not the
-      <a href=#current-node>current node</a>, this is a <a href=#parse-error>parse
-      error</a>. In any case, proceed with the algorithm as
-      written in the following steps.</p>
-
-     </li>
-
-     <li><p>Let the <var title="">furthest block</var> be the topmost
-     node in the <a href=#stack-of-open-elements>stack of open elements</a> that is lower in
-     the stack than the <var title="">formatting element</var>, and is
-     an element in the <a href=#special>special</a> category. There might not
-     be one.</li>
-
-     <li><p>If there is no <var title="">furthest block</var>, then
-     the UA must first pop all the nodes from the bottom of the
-     <a href=#stack-of-open-elements>stack of open elements</a>, from the <a href=#current-node>current
-     node</a> up to and including the <var title="">formatting
-     element</var>, then remove the <var title="">formatting
-     element</var> from the <a href=#list-of-active-formatting-elements>list of active formatting
-     elements</a>, and finally abort these steps.</li>
-
-     <li><p>Let the <var title="">common ancestor</var> be the element
-     immediately above the <var title="">formatting element</var> in the
-     <a href=#stack-of-open-elements>stack of open elements</a>.</li>
-
-     <li><p>Let a bookmark note the position of the <var title="">formatting element</var> in the <a href=#list-of-active-formatting-elements>list of active
-     formatting elements</a> relative to the elements on either
-     side of it in the list.</li>
-
-     <li>
-
-      <p>Let <var title="">node</var> and <var title="">last node</var> be the <var title="">furthest block</var>. Follow these steps:</p>
-
-      <ol><li><p>Let <var title="">inner loop counter</var> be zero.</li>
-
-       <li><p><i>Inner loop</i>: If <var title="">inner loop counter</var> is greater than or equal
-       to three, then go to the next step in the overall algorithm.</li>
-
-       <li><p>Increment <var title="">inner loop counter</var> by one.</li>
-
-       <li>Let <var title="">node</var> be the element immediately
-       above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
-       elements</a>, or if <var title="">node</var> is no longer in
-       the <a href=#stack-of-open-elements>stack of open elements</a> (e.g. because it got
-       removed by the next step), the element that was immediately
-       above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
-       elements</a> before <var title="">node</var> was
-       removed.</li>
-
-       <li>If <var title="">node</var> is not in the <a href=#list-of-active-formatting-elements>list of
-       active formatting elements</a>, then remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open
-       elements</a> and then go back to the step labeled <i>inner
-       loop</i>.</li>
-
-       <li>Otherwise, if <var title="">node</var> is the <var title="">formatting element</var>, then go to the next step
-       in the overall algorithm.</li>
-
-       <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
-       element <var title="">node</var> was created, with <var title="">common ancestor</var> as the intended parent; replace the entry
-       for <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active
-       formatting elements</a> with an entry for the new element,
-       replace the entry for <var title="">node</var> in the
-       <a href=#stack-of-open-elements>stack of open elements</a> with an entry for the new
-       element, and let <var title="">node</var> be the new
-       element.</li>
-
-       <li>If <var title="">last node</var> is the <var title="">furthest block</var>, then move the aforementioned
-       bookmark to be immediately after the new <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
-       elements</a>.</li>
-
-       <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous
-       parent node if any.</li>
-
-       <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
-
-       <li>Return to the step labeled <i>inner loop</i>.</li>
-
-      </ol></li>
-
-     <li><p>Insert whatever <var title="">last node</var> ended up being in the previous step at the <a href=#appropriate-place-for-inserting-a-node>appropriate
-     place for inserting a node</a>, but using <var title="">common ancestor</var> as the <i>override target</i>.</li>
-
-     <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
-     <var title="">formatting element</var> was created, with <var title="">furthest
-     block</var> as the intended parent.</li>
-
-     <li><p>Take all of the child nodes of the <var title="">furthest
-     block</var> and append them to the element created in the last
-     step.</li>
-
-     <li><p>Append that new element to the <var title="">furthest
-     block</var>.</li>
-
-     <li><p>Remove the <var title="">formatting element</var> from the
-     <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and insert the
-     new element into the <a href=#list-of-active-formatting-elements>list of active formatting
-     elements</a> at the position of the aforementioned
-     bookmark.</li>
-
-     <li><p>Remove the <var title="">formatting element</var> from the
-     <a href=#stack-of-open-elements>stack of open elements</a>, and insert the new element
-     into the <a href=#stack-of-open-elements>stack of open elements</a> immediately below
-     the position of the <var title="">furthest block</var> in that
-     stack.</li>
-
-     <li><p>Jump back to the step labeled <i>outer loop</i>.</li>
-
-    </ol><p class=note>Because of the way this algorithm causes elements
-    to change parents, it has been dubbed the "adoption agency
-    algorithm" (in contrast with other possible algorithms for dealing
-    with misnested content, which included the "incest algorithm", the
-    "secret affair algorithm", and the "Heisenberg algorithm").</p>
-
    </dd>
 
    <dt>A start tag token whose tag name is one of: "applet",
@@ -91332,8 +91180,166 @@
    <li><p>Pop elements from the <a href=#stack-of-open-elements>stack of open elements</a> until a <code><a href=#the-p-element>p</a></code> element
    has been popped from the stack.</li>
 
-  </ol><h6 id=parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>
+  </ol><p>The <dfn id=adoption-agency-algorithm>adoption agency algorithm</dfn>, which takes as its only argument a tag name <var title="">subject</var> for which the algorithm is being run, consists of the following steps:</p>
 
+<!--CLEANUP-->
+  <ol><li><p>Let <var title="">outer loop counter</var> be
+   zero.</li>
+
+   <li><p><i>Outer loop</i>: If <var title="">outer loop
+   counter</var> is greater than or equal to eight, then abort these
+   steps.</li>
+
+   <li><p>Increment <var title="">outer loop counter</var> by
+   one.</li>
+
+   <li>
+
+    <p>Let the <var title="">formatting element</var> be the last
+    element in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>
+    that:</p>
+
+    <ul><li>is between the end of the list and the last scope
+     marker in the list, if any, or the start of the list
+     otherwise, and</li>
+
+     <li>has the tag name <var title="">subject</var>.</li>
+
+    </ul><p>If there is no such node, then abort these steps and instead
+    act as described in the "any other end tag" entry below.</p>
+
+    <p>Otherwise, if there is such a node, but that node is not
+    in the <a href=#stack-of-open-elements>stack of open elements</a>, then this is a
+    <a href=#parse-error>parse error</a>; remove the element from the list,
+    and abort these steps.</p>
+
+    <p>Otherwise, if there is such a node, and that node is also in
+    the <a href=#stack-of-open-elements>stack of open elements</a>, but the element is not
+    <a href=#has-an-element-in-scope title="has an element in scope">in scope</a>, then this
+    is a <a href=#parse-error>parse error</a>; abort these
+    steps.</p>
+
+    <p>Otherwise, there is a <var title="">formatting
+    element</var> and that element is in <a href=#stack-of-open-elements title="stack of
+    open elements">the stack</a> and is <a href=#has-an-element-in-scope title="has an
+    element in scope">in scope</a>. If the element is not the
+    <a href=#current-node>current node</a>, this is a <a href=#parse-error>parse
+    error</a>. In any case, proceed with the algorithm as
+    written in the following steps.</p>
+
+   </li>
+
+   <li><p>Let the <var title="">furthest block</var> be the topmost
+   node in the <a href=#stack-of-open-elements>stack of open elements</a> that is lower in
+   the stack than the <var title="">formatting element</var>, and is
+   an element in the <a href=#special>special</a> category. There might not
+   be one.</li>
+
+   <li><p>If there is no <var title="">furthest block</var>, then
+   the UA must first pop all the nodes from the bottom of the
+   <a href=#stack-of-open-elements>stack of open elements</a>, from the <a href=#current-node>current
+   node</a> up to and including the <var title="">formatting
+   element</var>, then remove the <var title="">formatting
+   element</var> from the <a href=#list-of-active-formatting-elements>list of active formatting
+   elements</a>, and finally abort these steps.</li>
+
+   <li><p>Let the <var title="">common ancestor</var> be the element
+   immediately above the <var title="">formatting element</var> in the
+   <a href=#stack-of-open-elements>stack of open elements</a>.</li>
+
+   <li><p>Let a bookmark note the position of the <var title="">formatting element</var> in the <a href=#list-of-active-formatting-elements>list of active
+   formatting elements</a> relative to the elements on either
+   side of it in the list.</li>
+
+   <li>
+
+    <p>Let <var title="">node</var> and <var title="">last node</var> be the <var title="">furthest block</var>. Follow these steps:</p>
+
+    <ol><li><p>Let <var title="">inner loop counter</var> be zero.</li>
+
+     <li><p><i>Inner loop</i>: If <var title="">inner loop counter</var> is greater than or equal
+     to three, then go to the next step in the overall algorithm.</li>
+
+     <li><p>Increment <var title="">inner loop counter</var> by one.</li>
+
+     <li>Let <var title="">node</var> be the element immediately
+     above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
+     elements</a>, or if <var title="">node</var> is no longer in
+     the <a href=#stack-of-open-elements>stack of open elements</a> (e.g. because it got
+     removed by the next step), the element that was immediately
+     above <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open
+     elements</a> before <var title="">node</var> was
+     removed.</li>
+
+     <li>If <var title="">node</var> is not in the <a href=#list-of-active-formatting-elements>list of
+     active formatting elements</a>, then remove <var title="">node</var> from the <a href=#stack-of-open-elements>stack of open
+     elements</a> and then go back to the step labeled <i>inner
+     loop</i>.</li>
+
+     <li>Otherwise, if <var title="">node</var> is the <var title="">formatting element</var>, then go to the next step
+     in the overall algorithm.</li>
+
+     <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
+     element <var title="">node</var> was created, with <var title="">common ancestor</var> as the intended parent; replace the entry
+     for <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active
+     formatting elements</a> with an entry for the new element,
+     replace the entry for <var title="">node</var> in the
+     <a href=#stack-of-open-elements>stack of open elements</a> with an entry for the new
+     element, and let <var title="">node</var> be the new
+     element.</li>
+
+     <li>If <var title="">last node</var> is the <var title="">furthest block</var>, then move the aforementioned
+     bookmark to be immediately after the new <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active formatting
+     elements</a>.</li>
+
+     <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous
+     parent node if any.</li>
+
+     <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
+
+     <li>Return to the step labeled <i>inner loop</i>.</li>
+
+    </ol></li>
+
+   <li><p>Insert whatever <var title="">last node</var> ended up being in the previous step at the <a href=#appropriate-place-for-inserting-a-node>appropriate
+   place for inserting a node</a>, but using <var title="">common ancestor</var> as the <i>override target</i>.</li>
+
+   <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the
+   <var title="">formatting element</var> was created, with <var title="">furthest
+   block</var> as the intended parent.</li>
+
+   <li><p>Take all of the child nodes of the <var title="">furthest
+   block</var> and append them to the element created in the last
+   step.</li>
+
+   <li><p>Append that new element to the <var title="">furthest
+   block</var>.</li>
+
+   <li><p>Remove the <var title="">formatting element</var> from the
+   <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and insert the
+   new element into the <a href=#list-of-active-formatting-elements>list of active formatting
+   elements</a> at the position of the aforementioned
+   bookmark.</li>
+
+   <li><p>Remove the <var title="">formatting element</var> from the
+   <a href=#stack-of-open-elements>stack of open elements</a>, and insert the new element
+   into the <a href=#stack-of-open-elements>stack of open elements</a> immediately below
+   the position of the <var title="">furthest block</var> in that
+   stack.</li>
+
+   <li><p>Jump back to the step labeled <i>outer loop</i>.</li>
+
+  </ol><p class=note>This algorithm's name, the "adoption agency algorithm", comes from the way it
+  causes elements to change parents, and is in contrast with other possible algorithms for dealing
+  with misnested content, which included the "incest algorithm", the "secret affair algorithm", and
+  the "Heisenberg algorithm".</p>
+
+
+
+
+
+  <h6 id=parsing-main-incdata><span class=secno>12.2.5.4.8 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>
+
   <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>
@@ -93000,7 +93006,7 @@
      <dd>
 
       <p><a href=#acknowledge-self-closing-flag title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
-      flag</i></a>, and then act as if an end tag with the tag name "script" had been seen.</p>
+      flag</i></a>, and then act as described in the steps for a "script" end tag below.</p>
 
      </dd>
 

Modified: source
===================================================================
--- source	2013-07-01 21:19:49 UTC (rev 8001)
+++ source	2013-07-01 21:49:22 UTC (rev 8002)
@@ -99221,8 +99221,7 @@
 
   <hr>
 
-  <p>As each token is emitted from the tokenizer, and when the specification says that a user agent
-  is to <dfn>act as if a token had been seen</dfn>, the user agent must follow the appropriate steps
+  <p>As each token is emitted from the tokenizer, the user agent must follow the appropriate steps
   from the following list, known as the <dfn>tree construction dispatcher</dfn>:</p>
 
   <dl class="switch">
@@ -101257,10 +101256,11 @@
     contains an element whose tag name is "a" between the end of
     the list and the last marker on the list (or the start of the
     list if there is no marker on the list), then this is a
-    <span>parse error</span>; act as if an end tag with the tag
-    name "a" had been seen, then remove that element from the
+    <span>parse error</span>; run the <span>adoption agency
+    algorithm</span> for the tag name "a", then remove that element from the
     <span>list of active formatting elements</span> and the
-    <span>stack of open elements</span> if the end tag didn't
+    <span>stack of open elements</span> if the <span>adoption agency
+    algorithm</span> didn't
     already remove it (it might not have if the element is not
     <span title="has an element in table scope">in table
     scope</span>).</p>
@@ -101307,8 +101307,8 @@
 
     <p>If the <span>stack of open elements</span> <span title="has an
     element in scope">has a <code>nobr</code> element in scope</span>,
-    then this is a <span>parse error</span>; act as if an end tag with
-    the tag name "nobr" had been seen, then once again
+    then this is a <span>parse error</span>; run the <span>adoption agency algorithm</span> for
+    the tag name "nobr", then once again
     <span>reconstruct the active formatting elements</span>, if
     any.</p>
 
@@ -101323,180 +101323,8 @@
    "strike", "strong", "tt", "u"</dt>
    <dd>
 
-    <p>Run these steps:</p>
+    <p>Run the <span>adoption agency algorithm</span> for the token's tag name.</p>
 
-    <ol>
-
-     <li><p>Let <var title="">outer loop counter</var> be
-     zero.</p></li>
-
-     <li><p><i>Outer loop</i>: If <var title="">outer loop
-     counter</var> is greater than or equal to eight, then abort these
-     steps.</p></li>
-
-     <li><p>Increment <var title="">outer loop counter</var> by
-     one.</p></li>
-
-     <li>
-
-      <p>Let the <var title="">formatting element</var> be the last
-      element in the <span>list of active formatting elements</span>
-      that:</p>
-
-      <ul>
-
-       <li>is between the end of the list and the last scope
-       marker in the list, if any, or the start of the list
-       otherwise, and</li>
-
-       <li>has the same tag name as the token.</li>
-
-      </ul>
-
-      <p>If there is no such node, then abort these steps and instead
-      act as described in the "any other end tag" entry below.</p>
-
-      <p>Otherwise, if there is such a node, but that node is not
-      in the <span>stack of open elements</span>, then this is a
-      <span>parse error</span>; remove the element from the list,
-      and abort these steps.</p>
-
-      <p>Otherwise, if there is such a node, and that node is also in
-      the <span>stack of open elements</span>, but the element is not
-      <span title="has an element in scope">in scope</span>, then this
-      is a <span>parse error</span>; ignore the token, and abort these
-      steps.</p>
-
-      <p>Otherwise, there is a <var title="">formatting
-      element</var> and that element is in <span title="stack of
-      open elements">the stack</span> and is <span title="has an
-      element in scope">in scope</span>. If the element is not the
-      <span>current node</span>, this is a <span>parse
-      error</span>. In any case, proceed with the algorithm as
-      written in the following steps.</p>
-
-     </li>
-
-     <li><p>Let the <var title="">furthest block</var> be the topmost
-     node in the <span>stack of open elements</span> that is lower in
-     the stack than the <var title="">formatting element</var>, and is
-     an element in the <span>special</span> category. There might not
-     be one.</p></li>
-
-     <li><p>If there is no <var title="">furthest block</var>, then
-     the UA must first pop all the nodes from the bottom of the
-     <span>stack of open elements</span>, from the <span>current
-     node</span> up to and including the <var title="">formatting
-     element</var>, then remove the <var title="">formatting
-     element</var> from the <span>list of active formatting
-     elements</span>, and finally abort these steps.</p></li>
-
-     <li><p>Let the <var title="">common ancestor</var> be the element
-     immediately above the <var title="">formatting element</var> in the
-     <span>stack of open elements</span>.</p></li>
-
-     <li><p>Let a bookmark note the position of the <var
-     title="">formatting element</var> in the <span>list of active
-     formatting elements</span> relative to the elements on either
-     side of it in the list.</p></li>
-
-     <li>
-
-      <p>Let <var title="">node</var> and <var title="">last node</var> be the <var
-      title="">furthest block</var>. Follow these steps:</p>
-
-      <ol>
-
-       <li><p>Let <var title="">inner loop counter</var> be zero.</p></li>
-
-       <li><p><i>Inner loop</i>: If <var title="">inner loop counter</var> is greater than or equal
-       to three, then go to the next step in the overall algorithm.</p></li>
-
-       <li><p>Increment <var title="">inner loop counter</var> by one.</p></li>
-
-       <li>Let <var title="">node</var> be the element immediately
-       above <var title="">node</var> in the <span>stack of open
-       elements</span>, or if <var title="">node</var> is no longer in
-       the <span>stack of open elements</span> (e.g. because it got
-       removed by the next step), the element that was immediately
-       above <var title="">node</var> in the <span>stack of open
-       elements</span> before <var title="">node</var> was
-       removed.</li>
-
-       <li>If <var title="">node</var> is not in the <span>list of
-       active formatting elements</span>, then remove <var
-       title="">node</var> from the <span>stack of open
-       elements</span> and then go back to the step labeled <i>inner
-       loop</i>.</li>
-
-       <li>Otherwise, if <var title="">node</var> is the <var
-       title="">formatting element</var>, then go to the next step
-       in the overall algorithm.</li>
-
-       <li><span>Create an element for the token</span> for which the
-       element <var title="">node</var> was created, with <var title="">common ancestor</var> as the intended parent; replace the entry
-       for <var title="">node</var> in the <span>list of active
-       formatting elements</span> with an entry for the new element,
-       replace the entry for <var title="">node</var> in the
-       <span>stack of open elements</span> with an entry for the new
-       element, and let <var title="">node</var> be the new
-       element.</li>
-
-       <li>If <var title="">last node</var> is the <var
-       title="">furthest block</var>, then move the aforementioned
-       bookmark to be immediately after the new <var
-       title="">node</var> in the <span>list of active formatting
-       elements</span>.</li>
-
-       <li>Insert <var title="">last node</var> into <var
-       title="">node</var>, first removing it from its previous
-       parent node if any.</li>
-
-       <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
-
-       <li>Return to the step labeled <i>inner loop</i>.</li>
-
-      </ol>
-
-     </li>
-
-     <li><p>Insert whatever <var title="">last node</var> ended up being in the previous step at the <span>appropriate
-     place for inserting a node</span>, but using <var
-     title="">common ancestor</var> as the <i>override target</i>.</p></li>
-
-     <li><p><span>Create an element for the token</span> for which the
-     <var title="">formatting element</var> was created, with <var title="">furthest
-     block</var> as the intended parent.</p></li>
-
-     <li><p>Take all of the child nodes of the <var title="">furthest
-     block</var> and append them to the element created in the last
-     step.</p></li>
-
-     <li><p>Append that new element to the <var title="">furthest
-     block</var>.</p></li>
-
-     <li><p>Remove the <var title="">formatting element</var> from the
-     <span>list of active formatting elements</span>, and insert the
-     new element into the <span>list of active formatting
-     elements</span> at the position of the aforementioned
-     bookmark.</p></li>
-
-     <li><p>Remove the <var title="">formatting element</var> from the
-     <span>stack of open elements</span>, and insert the new element
-     into the <span>stack of open elements</span> immediately below
-     the position of the <var title="">furthest block</var> in that
-     stack.</p></li>
-
-     <li><p>Jump back to the step labeled <i>outer loop</i>.</p></li>
-
-    </ol>
-
-    <p class="note">Because of the way this algorithm causes elements
-    to change parents, it has been dubbed the "adoption agency
-    algorithm" (in contrast with other possible algorithms for dealing
-    with misnested content, which included the "incest algorithm", the
-    "secret affair algorithm", and the "Heisenberg algorithm").</p>
-
    </dd>
 
    <dt>A start tag token whose tag name is one of: "applet",
@@ -102032,8 +101860,185 @@
 
   </ol>
 
+  <p>The <dfn>adoption agency algorithm</dfn>, which takes as its only argument a tag name <var
+  title="">subject</var> for which the algorithm is being run, consists of the following steps:</p>
 
+<!--CLEANUP-->
+  <ol>
 
+   <li><p>Let <var title="">outer loop counter</var> be
+   zero.</p></li>
+
+   <li><p><i>Outer loop</i>: If <var title="">outer loop
+   counter</var> is greater than or equal to eight, then abort these
+   steps.</p></li>
+
+   <li><p>Increment <var title="">outer loop counter</var> by
+   one.</p></li>
+
+   <li>
+
+    <p>Let the <var title="">formatting element</var> be the last
+    element in the <span>list of active formatting elements</span>
+    that:</p>
+
+    <ul>
+
+     <li>is between the end of the list and the last scope
+     marker in the list, if any, or the start of the list
+     otherwise, and</li>
+
+     <li>has the tag name <var title="">subject</var>.</li>
+
+    </ul>
+
+    <p>If there is no such node, then abort these steps and instead
+    act as described in the "any other end tag" entry below.</p>
+
+    <p>Otherwise, if there is such a node, but that node is not
+    in the <span>stack of open elements</span>, then this is a
+    <span>parse error</span>; remove the element from the list,
+    and abort these steps.</p>
+
+    <p>Otherwise, if there is such a node, and that node is also in
+    the <span>stack of open elements</span>, but the element is not
+    <span title="has an element in scope">in scope</span>, then this
+    is a <span>parse error</span>; abort these
+    steps.</p>
+
+    <p>Otherwise, there is a <var title="">formatting
+    element</var> and that element is in <span title="stack of
+    open elements">the stack</span> and is <span title="has an
+    element in scope">in scope</span>. If the element is not the
+    <span>current node</span>, this is a <span>parse
+    error</span>. In any case, proceed with the algorithm as
+    written in the following steps.</p>
+
+   </li>
+
+   <li><p>Let the <var title="">furthest block</var> be the topmost
+   node in the <span>stack of open elements</span> that is lower in
+   the stack than the <var title="">formatting element</var>, and is
+   an element in the <span>special</span> category. There might not
+   be one.</p></li>
+
+   <li><p>If there is no <var title="">furthest block</var>, then
+   the UA must first pop all the nodes from the bottom of the
+   <span>stack of open elements</span>, from the <span>current
+   node</span> up to and including the <var title="">formatting
+   element</var>, then remove the <var title="">formatting
+   element</var> from the <span>list of active formatting
+   elements</span>, and finally abort these steps.</p></li>
+
+   <li><p>Let the <var title="">common ancestor</var> be the element
+   immediately above the <var title="">formatting element</var> in the
+   <span>stack of open elements</span>.</p></li>
+
+   <li><p>Let a bookmark note the position of the <var
+   title="">formatting element</var> in the <span>list of active
+   formatting elements</span> relative to the elements on either
+   side of it in the list.</p></li>
+
+   <li>
+
+    <p>Let <var title="">node</var> and <var title="">last node</var> be the <var
+    title="">furthest block</var>. Follow these steps:</p>
+
+    <ol>
+
+     <li><p>Let <var title="">inner loop counter</var> be zero.</p></li>
+
+     <li><p><i>Inner loop</i>: If <var title="">inner loop counter</var> is greater than or equal
+     to three, then go to the next step in the overall algorithm.</p></li>
+
+     <li><p>Increment <var title="">inner loop counter</var> by one.</p></li>
+
+     <li>Let <var title="">node</var> be the element immediately
+     above <var title="">node</var> in the <span>stack of open
+     elements</span>, or if <var title="">node</var> is no longer in
+     the <span>stack of open elements</span> (e.g. because it got
+     removed by the next step), the element that was immediately
+     above <var title="">node</var> in the <span>stack of open
+     elements</span> before <var title="">node</var> was
+     removed.</li>
+
+     <li>If <var title="">node</var> is not in the <span>list of
+     active formatting elements</span>, then remove <var
+     title="">node</var> from the <span>stack of open
+     elements</span> and then go back to the step labeled <i>inner
+     loop</i>.</li>
+
+     <li>Otherwise, if <var title="">node</var> is the <var
+     title="">formatting element</var>, then go to the next step
+     in the overall algorithm.</li>
+
+     <li><span>Create an element for the token</span> for which the
+     element <var title="">node</var> was created, with <var title="">common ancestor</var> as the intended parent; replace the entry
+     for <var title="">node</var> in the <span>list of active
+     formatting elements</span> with an entry for the new element,
+     replace the entry for <var title="">node</var> in the
+     <span>stack of open elements</span> with an entry for the new
+     element, and let <var title="">node</var> be the new
+     element.</li>
+
+     <li>If <var title="">last node</var> is the <var
+     title="">furthest block</var>, then move the aforementioned
+     bookmark to be immediately after the new <var
+     title="">node</var> in the <span>list of active formatting
+     elements</span>.</li>
+
+     <li>Insert <var title="">last node</var> into <var
+     title="">node</var>, first removing it from its previous
+     parent node if any.</li>
+
+     <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
+
+     <li>Return to the step labeled <i>inner loop</i>.</li>
+
+    </ol>
+
+   </li>
+
+   <li><p>Insert whatever <var title="">last node</var> ended up being in the previous step at the <span>appropriate
+   place for inserting a node</span>, but using <var
+   title="">common ancestor</var> as the <i>override target</i>.</p></li>
+
+   <li><p><span>Create an element for the token</span> for which the
+   <var title="">formatting element</var> was created, with <var title="">furthest
+   block</var> as the intended parent.</p></li>
+
+   <li><p>Take all of the child nodes of the <var title="">furthest
+   block</var> and append them to the element created in the last
+   step.</p></li>
+
+   <li><p>Append that new element to the <var title="">furthest
+   block</var>.</p></li>
+
+   <li><p>Remove the <var title="">formatting element</var> from the
+   <span>list of active formatting elements</span>, and insert the
+   new element into the <span>list of active formatting
+   elements</span> at the position of the aforementioned
+   bookmark.</p></li>
+
+   <li><p>Remove the <var title="">formatting element</var> from the
+   <span>stack of open elements</span>, and insert the new element
+   into the <span>stack of open elements</span> immediately below
+   the position of the <var title="">furthest block</var> in that
+   stack.</p></li>
+
+   <li><p>Jump back to the step labeled <i>outer loop</i>.</p></li>
+
+  </ol>
+
+  <p class="note">This algorithm's name, the "adoption agency algorithm", comes from the way it
+  causes elements to change parents, and is in contrast with other possible algorithms for dealing
+  with misnested content, which included the "incest algorithm", the "secret affair algorithm", and
+  the "Heisenberg algorithm".</p>
+
+
+
+
+
   <h6 id="parsing-main-incdata">The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>
 
   <p>When the user agent is to apply the rules for the "<span title="insertion mode: text">text</span>" <span>insertion mode</span>, the user agent must handle the token as follows:</p>
@@ -103873,7 +103878,7 @@
      <dd>
 
       <p><span title="acknowledge self-closing flag">Acknowledge the token's <i>self-closing
-      flag</i></span>, and then act as if an end tag with the tag name "script" had been seen.</p>
+      flag</i></span>, and then act as described in the steps for a "script" end tag below.</p>
 
      </dd>
 




More information about the Commit-Watchers mailing list