[whatwg] overlap and Browser DOMs

Anne van Kesteren annevk at opera.com
Fri Feb 2 10:09:32 PST 2007


On Fri, 02 Feb 2007 19:04:37 +0100, Elliotte Harold  
<elharo at metalab.unc.edu> wrote:
> Consider the following markup:
>
> <div>
> <p>...foo<strong id='s1'>...</p>
> <p>...bar</strong> </p>
> </div>
>
> Notice that the string element starts in one p and finished in the next.  
> This is of course malformed and violates the tree structure.
>
> Has anyone documented how different browsers handle this in their  
> respective DOMs? e.g. creating three separate strong elements or  
> creating one that is a child of three parents?

http://whatwg.org/specs/web-apps/current-work/#parsing

html5lib |python parse.py -x "<div><p>foo<strong  
id=x>...</p><p>bar</strong>...</p>| gives:

#document
|  <html>
|    <head>
|    <body>
|      <div>
|        <p>
|          "foo"
|          <strong>
|            id="x"
|            "..."
|        <p>
|          <strong>
|            id="x"
|            "bar"
|          "..."

You can compare that with  
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cdiv%3E%3Cp%3Efoo%3Cstrong%20id%3Dx%3E...%3C/p%3E%3Cp%3Ebar%3C/strong%3E...%3C/p%3E  
browsers.

Cheers,


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>



More information about the whatwg mailing list