Re: Possible issue with 4.01 strict validator?

Char-Lez Braden wrote:
> 
> Hello,
> 
> I am seeing some behavior I cannot explain that might be a problem with 
> the validator.
> 
> This URL http://www.freecitizen.com/demo.html shows a very small HTML 
> document that the validator says is good, but looks I believe the HTML 
> is missing a </p> tag (Right above the </body> tag).   When I put the 
> <p> tag in (http://www.freecitizen.com/demo2.html) I get the message 
> "Error  Line 19 column 7: end tag for element "P" which is not open."
> 
> When I look at the parse tree (demo.html) it appears to me that the 
> validator is inserting a </p> just before the <ul> tag.
What you are missing is that the <ul> element is a Block element, and 
the <p> element (also a Block element) cannot contain another block element.

The xhtml version of this would be:
   <body>
     <p>yack yack yack</p>
     <p>blah blah blah</p>
     <p></p> <!-- could also do <p /> -->
       <ul>
         <li><a href='http://www.freecitizen.com/'>item 1</a></li>
         <li><a href='http://www.freecitizen.com/'>item 2</a></li>
       </ul>
  </body>
(I've squished things to make the message smaller)

Because html 4.01 defines closing tags as optional for <p>, the opening 
<ul> implies the closing </p>, therefor putting the </p> after the </ul> 
closes a <p> that is, in fact, already closed.

Hope this helps.

-- 

Ian Stuart.
Bibliographics and Multimedia Service Delivery team,
EDINA,
The University of Edinburgh.

http://edina.ac.uk/

Received on Tuesday, 30 August 2005 13:21:30 UTC