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

Lachlan Hunt lachlan.hunt at lachy.id.au
Thu Apr 7 19:28:11 PDT 2005


Ian Hickson wrote:
> On Thu, 7 Apr 2005, Henri Sivonen wrote:
> 
>>The problem with allowing the HTML flavor and XHTML flavor diverge is 
>>that one could no longer use HTML and XHTML serializations 
>>interchangeably in apps that do not suffer from the HTML DOM legacy and 
>>otherwise could treat the HTML-XHTML distinction as something you deal 
>>with on the IO boundary.
>>
>>I use Java XML tools for producing HTML. I use XHTML internally and 
>>serialize as HTML. This works great with XHTML 1.0 and HTML 4.01. If the 
>>HTML flavor of What WG HTML and the XHTML flavor diverge, I'd need to 
>>spec that only an HTML-compatible subset of What WG XHTML that doesn't 
>>nest elements in ways prohibited on the text/html side may be put into 
>>an app that outputs text/html.


I don't think it's necessary to make HTML and XHTML diverge with 
relation to the element content models.  I think the spec should just 
provide notes about backwards compatibility for older UAs that won't 
support such constructs properly; however, they will degrade gracefully.

New UAs could be updated to handle <p><ol>...</ol></p> correctly (when 
an HTML5 doctype is used) as text/html.  So, this would produce the 
following DOM for a current UA:

* (any parent element)
+-P
+-OL

But for a new UA, it would produce (just like an XHTML UA will)

*
+-P
   +-OL

However, I realise that may cause issues with supporting existing HTML4 
documents, as it would require further DOCTYPE sniffing (or a proper 
SGML implementation that reads the DOCTYPE) to produce the correct DOMs 
in each case, but it might be a solution worth considering.

> 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?  If it were this, it would be more acceptable

<p>...
   <object type="image/png" data="list.png"><ol>...</ol></object>
<p>

> On the other hand, there already are other big differences between HTML5 
> and XHTML5 (or whatever we end up calling them).

Calling it XHTML5 would be very confusing, as people won't understand 
that this version is on a track and for a purpose that is different from 
XHTML2.  I'd call it something like (X)HTML Applications 1.0 (maybe it 
could be shortened to XHTML Apps and HTML Apps 1, or (even shorter) 
HAppy 1.0).  That name would, of course, include web-apps, web-forms and 
web-controls.

> 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.

-- 
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/     Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox




More information about the whatwg mailing list