Skip to content
Permalink
Browse files

[giow] (3) Adjust the Adoption Agency Algorithm to not reverse the or…

…der of nodes in the document, by removing nodes that we're not recreating from the stack of open elements.

Affected topics: HTML Syntax and Parsing

git-svn-id: http://svn.whatwg.org/webapps@8108 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Jul 31, 2013
1 parent 69a860f commit 22ce3c31d8054c154042fd07150318a99ecc3e1b
Showing with 20 additions and 21 deletions.
  1. +6 −7 complete.html
  2. +6 −7 index
  3. +8 −7 source

<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><p><i>Inner loop</i>: Increment <var title="">inner loop counter</var> by one.</li>

<li><p>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 this algorithm<!-- in
particular, the step labeled "removal" below -->), 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><p>If <var title="">node</var> is <var title="">formatting element</var>, then go to the
next step in the overall algorithm.</li>

<li><p>If <var title="">inner loop counter</var> is greater than three and <var title="">node</var> is 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=#list-of-active-formatting-elements>list of active formatting elements</a>.</li>

<li><p><!-- "removal" step: -->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><p>Otherwise, if <var title="">node</var> is <var title="">formatting element</var>, then
go to the next step in the overall algorithm.</li>

<li><p><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
13 index

<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><p><i>Inner loop</i>: Increment <var title="">inner loop counter</var> by one.</li>

<li><p>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 this algorithm<!-- in
particular, the step labeled "removal" below -->), 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><p>If <var title="">node</var> is <var title="">formatting element</var>, then go to the
next step in the overall algorithm.</li>

<li><p>If <var title="">inner loop counter</var> is greater than three and <var title="">node</var> is 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=#list-of-active-formatting-elements>list of active formatting elements</a>.</li>

<li><p><!-- "removal" step: -->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><p>Otherwise, if <var title="">node</var> is <var title="">formatting element</var>, then
go to the next step in the overall algorithm.</li>

<li><p><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
15 source

<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><p><i>Inner loop</i>: Increment <var title="">inner loop counter</var> by one.</p></li>

<li><p>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
title="">node</var> in the <span>stack of open elements</span> before <var title="">node</var>
was removed.</p></li>

<li><p>If <var title="">node</var> is <var title="">formatting element</var>, then go to the
next step in the overall algorithm.</p></li>

<li><p>If <var title="">inner loop counter</var> is greater than three and <var
title="">node</var> is in the <span>list of active formatting elements</span>, then remove <var
title="">node</var> from the <span>list of active formatting elements</span>.</p></li>

<li><p><!-- "removal" step: -->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>.</p></li>

<li><p>Otherwise, if <var title="">node</var> is <var title="">formatting element</var>, then
go to the next step in the overall algorithm.</p></li>

<li><p><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

0 comments on commit 22ce3c3

Please sign in to comment.
You can’t perform that action at this time.