Re: Wrong error defn: P containing DIV

On Wed, 2002-11-27 at 22:31, Saila, Craig wrote:
> In HTML 4.01 documents (strict or transitional), where a <p> contains a
> <div>, the wrong error definition appears. 
> 
> Instead of:
> Line [x], column [x]:  document type does not allow element "div" here;
> missing one of "object", "ins", "del", "map", "button" start-tag
> 
> This is displayed:
> Line [x], column [x]: end tag for element "P" which is not open

...and the snipped (explain...) link provides the explanation at
<http://validator.w3.org/docs/errors.html#floating-close>:

    A subtle variation of this is <P><H4>fake font change</H4></P>.
    <H4>'s aren't allowed inside <P>'s, but since HTML allows you to
    omit the </P> end tag for paragraphs, the validator assumes that you
    meant <P></P><H4>fake font change</H4></P>, in which case the final
    </P> is indeed superfluous. 

Thus, in your test case, there's superfluous character data and </p>
after the </div>, just like the validator reports.

> With a XHTML DOCTYPE (strict or transitional), the correct message
> appears.

Yes, because in XHTML the <p> is not implicitly closed by the <div>
(hint: nothing gets implicitly closed in XML).

-- 
\/ille Skyttä
ville.skytta at iki.fi

Received on Thursday, 28 November 2002 14:46:09 UTC