Re: Bad validator error

Allowing implicit closing of elements was a bad idea from the start.

I am stunned that issuing warnings for this is not automatic for the
validator.    Perhaps issuing warnings for any implicitly closed element
should be done for all HTML5 documents.


----- Original Message -----
From: Jukka K. Korpela <jkorpela@cs.tut.fi>
To: www-validator@w3.org; cop3252@yahoo.com
Cc: 
Sent: Friday, September 23, 2011 11:29 AM
Subject: Re: Bad validator error

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:45:46 UTC