W3C home > Mailing lists > Public > www-validator@w3.org > November 2002

Re: Wrong error defn: P containing DIV

From: Ville Skyttä <ville.skytta@iki.fi>
Date: 28 Nov 2002 21:50:11 +0200
To: www-validator@w3.org
Message-Id: <1038513011.25230.220.camel@localhost.localdomain>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:04 GMT