W3C home > Mailing lists > Public > www-validator@w3.org > September 2011

Re: Bad validator error

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Fri, 23 Sep 2011 18:29:04 +0300
Message-ID: <4E7CA5C0.8000803@cs.tut.fi>
To: www-validator@w3.org, cop3252@yahoo.com
23.9.2011 18:06, Joe Java wrote:

>       <p>
>         <ul>
>           <li>  red</li>
>         </ul>
>       </p>
[...]
> gives this error when validated:
> Line 11, Column 9: No p element in scope but a p end tag seen.

That's correct because the </p> tag _is_ homeless. The <ul> tag 
implicitly closes an open p element that was started by <p>. This 
follows purely from the syntax rules.

> This error message goes away if a "p" tag is inserted immediately
> before line 11 (the closing "p" tag).

Yes, because the error then goes away, syntactically. You then have an 
empty p element, followed by a ul element, followed by an empty p element.

> This is wrong.  Please fix the validator.

It is correct behavior; the validator correctly reports a syntax error.

Perhaps the validator could issue a _warning_ about an empty p element, 
but that would be complicated (HTML 4.01 prose says that such elements 
should not be used, but I don't think HTML5 has any such statement) - 
and it would need to be separately programmed, which would we difficult, 
I've understood, since the validator is simply based on a generic SGML 
parser.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/
Received on Friday, 23 September 2011 15:29:49 GMT

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