W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2012

Re: [whatwg] Question on Limits in Adaption Agency Algorithm

From: Adam Barth <w3c@adambarth.com>
Date: Sat, 3 Nov 2012 09:34:34 -0700
Message-ID: <CAJE5ia8mT0Kn50KM-OU7B1tF6iOEsVF20FfhEFnXi-MPfZT=-w@mail.gmail.com>
To: Yasuhiko Minamide <minamide@cs.tsukuba.ac.jp>
Cc: whatwg@whatwg.org
On Fri, Nov 2, 2012 at 9:50 PM, Yasuhiko Minamide
<minamide@cs.tsukuba.ac.jp> wrote:
> This is about Adaption Agency Algorithm in 12.2.5.4.7 The "in body" insertion
> mode.
>
> Limits of loops in the adoption agency algorithm were introduced
> in http://html5.org/tools/web-apps-tracker?from=5641&to=5642.
> However, the limit for the inner loop introduces an unexpected behaviour for
> the following fragment of an HTML document.
>
> <b><i><a><s><tt><div></b>abc</b></div></tt></s></a>xyz</i>
>
> This document is parsed into the following DOM tree.
>
> <b>
>   <i>
>     <a>
>       <s>
>         <tt></tt>
>       </s>
>     </a>
>     "xyz"
>   </i>
> </b>
> <a>
>   <s>
>     <tt>
>       <div>
>         <b></b>
>         "abc"
>       </div>
>     </tt>
>   </s>
> </a>
>
> "xyz" is inserted as a child of <i> and the order between "abc" and "xyz" is
> reversed in the tree. We would like to know whether this is an intended
> behaviour of the specification.
>
> We are aware that the similar reversal occurs in markup-in-tables.

The DOM you get when you hit the limits in the adoption agency
algorithm don't make a lot of intuitive sense.  Unfortunately, the
limits are necessary so that implementations don't end up having to do
quadratic work.  If this behavior is causing you trouble, you might
want to run your content through some sort of pre-processor that
re-writes these cases into valid HTML, which should get parsed in
intuitive ways by user agents.

Adam
Received on Saturday, 3 November 2012 16:35:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT