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

Lachlan Hunt lachlan.hunt at lachy.id.au
Wed Apr 6 18:36:55 PDT 2005


Ian Hickson wrote:
> One thing that XHTML2 does which makes a lot of sense to me is allow 
> nesting of certain elements within <p> elements, as in:
> ...
> I think the following should be allowed:
> 
>   <p>
>    ...
>    <table>
>     <tr>
>      <td>
>       <p>...</p>
>      </td>
>     </tr>
>    </table>
>   </p>

As you said below...

   “I'm especially interested in what use cases I may have missed
    (please don't say "I think this should be allowed" without giving
    a real-world example), and whether anyone thinks any of the cases
    I think should be allowed should not.”

however, you did not provide a use case.  What is the use case for this? 
  I can't think of any reason to allow tables to be nested inside <p>?

> I'm trying to work out exactly what the rules that describe the above 
> actually are, but I'm interested in hearing whether people agree or 
> disagree with my "good" and "bad" examples above. I'm especially 
> interested in what use cases I may have missed (please don't say "I think 
> this should be allowed" without giving a real-world example), and whether 
> anyone thinks any of the cases I think should be allowed should not.

You missed <p><blockquote/></p>.  Do I really have to give a real world 
example for this?  Well, ok...

<p>As you said below:

   <blockquote>I'm especially interested in what use cases I may have
       missed (please don't say "I think this should be allowed" without
       giving a real-world example), and whether anyone thinks any of the
       cases I think should be allowed should not."
   </blockquote>

however, you did not provide a use case.  What is the use case for this? 
  I can't think of any reason to allow tables to be nested inside 
<p>?</p>

:-)

<blockcode> should probably be allowed too, though it doesn't seem to be 
included in web apps.  Oh well, that's probably a discussion for another 
thread anyway, if it hasn't already been discussed (I'll search the 
archives later).

> Note that all of this would only be relevant to XHTML content (i.e. in an 
> XML context), since in text/html HTML we are pretty much stuck with the 
> existing parsing models which do things like close <p> elements upon 
> hitting another block-level element.

It's a shame no browser actually reads the DTD, this wouldn't be a 
problem if they did :-(.  This is one reason why HTML should be a true 
SGML application, and why browsers should have been built to conform.

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