[whatwg] Tag Soup: Blocks-in-inlines

David Hyatt hyatt at apple.com
Wed Jan 25 18:06:08 PST 2006

My 2 cents.

It took me a long time to develop an algorithm that actually fixed  
all 60 of the duplicate internal Apple bugs on this subject.  I'm  
reluctant to revisit this problem in our code base, given that my  
current algorithm was developed both to solve the problem and to be  
extremely performant and internally consistent.  For example,  
allowing blocks inside inlines minimizes the number of residual style  
tags that you have to re-open, and deferring the reopening of such  
tags until a misnested close tag is encountered ensures that well- 
formed documents don't end up with a bloated DOM.  Blocks inside  
inlines simply must be allowed.

Your DOM would grow unacceptably large on real-world pages if you try  
to restrict blocks from being inside inlines and end up reopening the  
inlines over and over again inside each block.  Not to mention that  
even without the residual style problem, sites rely on being able to  
nest blocks inside inlines (for example, an inline link that wraps  
multiple paragraphs but expects them to be a single link and not  
multiple links).

(hyatt at apple.com)

On Jan 25, 2006, at 5:41 PM, Ian Hickson wrote:

> On Wed, 25 Jan 2006, Simon Pieters wrote:
>> Thus, <em><p>XY</p></em> should be parsed as:
>>   + EM
>>   + P
>>     + EM
>>       + #text: XY
>> ...IMHO.
> This breaks in the face of <a><h3/><h3/></a>, sadly (see my earlier  
> mail).
> Otherwise I'd agree.
> -- 
> 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