W3C home > Mailing lists > Public > www-validator@w3.org > April 2003

Re: I think I've found a file that fails & shouldn't

From: Terje Bless <link@pobox.com>
Date: Fri, 18 Apr 2003 22:09:51 +0200
To: W3C Validator <www-validator@w3.org>
cc: David Thielen <dave@windward.net>
Message-ID: <a0106000f-1025-B6F21DAB71D911D7B5DF0030657B83E8@[193.157.66.23]>

David Thielen <dave@windward.net> wrote:

>There is a <p> ... tons of elements ... </p> but they are balanced.

As an alternate way of stating what others have allready said:

<p> elements are not allowed to nest so that when the Validator (or a
browser) sees an opening "<p>" tag it will automatically close (insert
"</p>") any <p> element that is open at that point.


<p>    <!-- Opens first P element -->
  <p>  <!-- P cannot nest; close first P before opening second P -->
  </p> <!-- Closes second P element -->
</p>   <!-- Error, there are no open P elements at this point. -->


In XHTML (which is stricter then HTML 4) you would have gotten an error at
the second <p> because in XHTML elements are not allowed to have omitted
end tags. HTML 4 is more permissive so it lets you get away with the first
implied end tag, but will then complain when you have an apparently
extraneous end tag at the end.

One good way to discover this kind of error is to turn on the Validator's
Verbose mode and look at the Parse Tree. It would have showed you where the
Validator inserted the implied </p> in the above code.

-- 
Now Playing "Strange Fruit" by "Nina Simone"",
 from the album "Feeling Good - The Very Best Of".
Received on Friday, 18 April 2003 16:10:04 GMT

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