This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
http://www.w3.org/html/wg/drafts/html/master/syntax.html#foster-parenting In particular, if the prose is interpreted as in-order steps, then I think it's possible to get the wrong answer. I think maybe it's best describe this as a algorithm which selects the foster parent element.
HTML5.1 Bugzilla Bug Triage: Fixed -- apparently by merging in some WHATWG revisions that algorithm-ified this section. If this resolution is not satisfactory, please copy the relevant bug details/proposal into a new issue at the W3C HTML5 Issue tracker: https://github.com/w3c/html/issues/new where it will be re-triaged. Thanks!