[whatwg] Tag Soup: Blocks-in-inlines

Ian Hickson ian at hixie.ch
Thu Jan 26 12:44:19 PST 2006


On Thu, 26 Jan 2006, Mikko Rantalainen wrote:
> 
> I think a simple way to parse what the author meant is to use just the
> following rules:
> 
> 1) An opening tag always starts a new element
> 2) A matching closing tag closes the element
> 3) A non-matching closing tag (top of the element stack
>    doesn't match with the closing tag) closes all still
>    open elements until a match is found. Exceptions for
>    this rule:
>      3.1) There's no matching element in the stack.
>           The closing tag will be ignored.
>      3.2) Closing tag is for inline element and closing
>           it would require closing a block-level element.
>           The closing tag will be ignored.
> 4) At the end of file, all still open elements are closed.

That is completely inadequate. It doesn't handle even the most basic of 
mis-nested tags in a compatible way, e.g.:

   <em>
     <div>
       XXX
     </em>
     XXX
   </div>

> Applying these rules to example 
>   <em><p><span><h1>X</em>Y</span>Z</h1></p>
> gives us
> 
> EM
> + P
>   + SPAN
>     + H1
>       + #text: XYZ
> 
> which is about the same as Safari's interpretation.

Unfortunately Safari's interpretation in this particular case is not 
compatible with IE/Mozilla/Opera.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list