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

Ian Hickson ian at hixie.ch
Mon Apr 11 15:40:27 PDT 2005


On Mon, 11 Apr 2005, fantasai wrote:
> > 
> >    <pre><code> ... </code></pre>
> >    <blockcode> ... </blockcode>
> > 
> > ...and given that the former would work in all existing UAs and the 
> > second wouldn't, and the former has the same semantics as the second, 
> > I don't see much of an advantage to the second.
> 
> It's similar to the distinction between
>   <div><q> ... </q></div>
> and
>   <blockquote> ... </blockquote>

Yes, except that <blockquote> works, and <blockcode> doesn't. Also, 
<blockquote>'s content model is further block-level elements, whereas <q>s 
isn't; whereas <pre>'s content model is inline content, the same as 
<code>.

So <pre><code> is actually closer to <p><q> than <div><q>, from a syntax 
point of view.


> >    <ol>
> >     <li>
> >      <p>...</p>
> >      <p>...</p>
> >      <p>...</p>
> >      <p>
> >       ...
> >       <ol>
> >        <li>...
> 
> You're still indirectly nesting paragraphs here.

Could you explain? I don't see any nested paragraphs there, nor in the 
definition in the spec (which is more important I guess).


> Although I agree that you get nested paragraphs with blockquote, I don't 
> think that the author's own text would have a paragraph within a 
> paragraph, list markers notwithstanding.

I agree.


> <pre> means <preformatted> not <preserve whitespace>. You should not 
> have block-level markup within <pre>; block-level distinctions within 
> <preformatted> text (such as plaintext emails) are given by the previous 
> formatting (e.g. whitespace).
> 
> (Yes, I meant 'e.g.'; C code is preformatted, too, but its block level 
> distinctions are given by braces and the like.)

Fair enough.

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