[whatwg] <p> elements containing other block-level elements
Ian Hickson
ian at hixie.ch
Wed Apr 6 18:07:07 PDT 2005
One thing that XHTML2 does which makes a lot of sense to me is allow
nesting of certain elements within <p> elements, as in:
<p>
For this recipe you need
<ul>
<li>an egg,</li>
<li>flour, and</li>
<li>butter.</li>
</ul>
Mix it all together and so forth.
</p>
Other elements that I could see being nested inside a paragraph are:
* <ol>
* <ul>
* <dl>
* <menu>
* <table>
* <pre>
Now, one question is how exactly should this work with respect to nesting.
I think the following should be allowed:
<p>
...
<table>
<tr>
<td>
<p>...</p>
</td>
</tr>
</table>
</p>
<p>
...
<ol>
<li>...</li>
</ol>
</p>
<ol>
<li>
<p>
...
<ol>
<li>
...
<pre>
<p>...</p>
<p>...</p>
</pre>
<p>
...
<pre>...</pre>
</p>
I think the following should not:
<p>
...
<p>...</p>
</p>
<p>
...
<ol>
<li>
...
<p>...</p>
</li>
</ol>
</p>
<pre>
...
<pre>...</pre>
</pre>
<p>
...
<table>
<tr>
<td>
<section>
...
<p>
...
<ol>
<li>
<h4>
...
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.
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.
--
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