[wp-hackers] p inside blockquote

Elliotte Harold elharo at metalab.unc.edu
Fri Mar 2 14:44:06 GMT 2007


Scot Hacker wrote:

> Why? div, blockquote, and p are block-level equals. No XHTML rule says 
> that content inside a div or a blockquote must be in a p container. But 
> WP apparently thinks it must be so.

Actually that's partially wrong, at least in XHTML strict. A blockquote 
must contain block-level elements such as div or p. It cannot validly 
contain raw text. I.e. this is invalid:

<blockquote>foo</blockquote>


However this is valid:

<blockquote><p>foo</p></blockquote>


as is this:

<blockquote><div>foo</div></blockquote>

The relevant declarations are

<!ELEMENT blockquote %Block;>
<!ENTITY % block
      "p | %heading; | div | %lists; | %blocktext; | fieldset | table">
<!ENTITY % Block "(%block; | form | %misc;)*">

Raw unparented PCDATA isn't allowed in a blockquote.

However in XHTML transitional this changes. Here the content model for 
blockquote is different:

<!ELEMENT blockquote %Flow;>

Thus raw unparented PCDATA is allowed in a blockquote, so it depends on 
which DTD you're using.

Interestingly in HTML 4.0.1 the raw data is not allowed:

<!ELEMENT BLOCKQUOTE - - (%block;|SCRIPT)+ -- long quotation -->

So this is a rare case in which XHTML Transitional is less strict than 
classic HTML, not more.


-- 
Elliotte Rusty Harold  elharo at metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/


More information about the wp-hackers mailing list