[whatwg] <p> elements containing other block-level elements

Ian Hickson ian at hixie.ch
Fri Apr 8 03:14:07 PDT 2005

On Fri, 8 Apr 2005, Lachlan Hunt wrote:
> New UAs could be updated to handle <p><ol>...</ol></p> correctly (when an
> HTML5 doctype is used) as text/html.

They could, but unfortunately the reality is they won't. Just introducing 
new elements in their HTML parsers gives implementors headaches; I 
wouldn't dare suggest they should introduce yet another parsing mode.

> > One possible hack is to say that when you serialise this kind of stuff 
> > to HTML, you have to wrap the problematic elements in <object> tags, 
> > so that for example this XML:
> >
> >    <p> <object><ol>...</ol></object> </p>
> Isn't that just abuse of somewhat semantic element (representing 
> external content that should be embedded within the document), for a 
> completely non-semantic hack?

Yeah; like I said, it's a hack.

> > For instance, in the XHTML variant you can use embedded MathML. Is 
> > this just a case like that?
> I don't think so.  MathML can't be used in HTML because there are no 
> namespaces.  Whereas, the only reason <p><ol/></p> can't be used in HTML 
> is for bugwards compatibility.

Effectively, yes, if you consider HTML to be an SGML application. (Note 
that HTML1 was not an SGML application; HTML2 was retrofitted into the 
SGML world for theoretical reasons, but the real world never really caught 
up with that theory.)

In practice, though, the reason is the same as for MathML: The XML parser 
is a generic parser, the HTML parser is not. We can change content models 
and add concepts like namespaces to the XML parser easily; we can at best 
add new elements when it comes to the HTML parser.

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