[whatwg] List Headers

On 5/2/09 08:18, Markus Ernst wrote:
> A different use case in the same problem field: Often you have lists
> that are actually part of a paragraph, but cannot be correctly
> associated with the paragraph:
>
> <p>Text before ...</p>
> <p>There are lots of fruits available, e.g.:</p>
> <ul>
> <li>Apples</li>
> <li>Pears</li>
> </ul>
> <p>More Text...</p>
>
> More appropriate markup for this could be achieved with the LH suggestion:
>
> <p>Text before ...</p>
> <ul>
> <lh>There are lots of fruits available, e.g.:</lh>
> <li>Apples</li>
> <li>Pears</li>
> </ul>
> <p>More Text...</p>
>
> Anyway I would consider it even more appropriate to allow the list
> inside a paragraph:
> <p>Text before ...</p>
> <p>There are lots of fruits available, e.g.:
> <ul>
> <li>Apples</li>
> <li>Pears</li>
> </ul>
> </p>
> <p>More Text...</p>
>
> But I admit I have no idea what other problems this could cause.

I agree (?) that the use case you raise is not "list headers" but lists 
inside paragraphs, and I agree that nested block content can 
legitimately be placed inside a paragraph - it certainly is in print. 
Other examples of legitimately nested content would include quotations 
and perhaps tables.

But HTML5 cannot allow "ul" (or "blockquote" or "table") as children of 
"p" in the text/html serialization because legacy content relies on "p" 
end-tag insertion before those block element's start tags. In other 
words, web-corpus-compatible parsers need to parse the above as 
equivalent to:

<p>Text before ...</p>
<p>There are lots of fruits available, e.g.:</p>
<ul>
<li>Apples</li>
<li>Pears</li>
</ul>
<p></p>
<p>More Text...</p>

HTML5's definition of how to interpret non-"p" content as "paragraphs" 
excludes using any alternate wrapper (e.g. "div") to wrap the text and 
the "ul" as one semantic paragraph.

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

<div>Hamlet said:
<blockquote><p>To be or not to be, that is the question</p></blockquote>
? and lots of other things.</div>

is to be interpreted as three serial paragraphs not one paragraph with a 
paragraph in a nested quotation.

Using a "div" wrapper or adding a class ("continuation"?) to nested and 
continuing fragments will at least allow authors to emulate print 
conventions with CSS, however.

I believe nesting blocks inside "p" elements is currently allowed in the 
XML serialization, however, since HTML5 does not face the same 
web-corpus-parsing constraints there.

--
Benjamin Hawkes-Lewis

Received on Thursday, 5 February 2009 01:08:14 UTC