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

Re: HTML end tags for empty elements

From: David Dorward <david@dorward.me.uk>
Date: Sat, 10 Sep 2005 12:56:56 +0100
To: Alun Jones <a.jones@hccnet.nl>
Cc: www-validator@w3.org
Message-Id: <1126353416.7134.18.camel@manage.dorward.me.uk.local>

On Sat, 2005-09-10 at 10:42 +0200, Alun Jones wrote:
> In HTML the element input and img are not flagged as errors when end
> tags are added:
> <input type="text" />

While it is almost certainly an error on the part of the author, it
isn't a syntax error as defined by SGML and the HTML DTDs, nor is it a
syntax error as defined by the prose of the HTML specification.

The long explanation can be found at
http://www.cs.tut.fi/~jkorpela/html/empty.html

The short version is that:

* <input type="text" / is, in HTML, equivalent to <input type="text">.
Therefore:
* <input type="text" /> is, in HTML, equivalent to <input type="text">>.
Therefore
* <input type="text" /> is, in HTML, equivalent to <input
type="text">&gt;.

and anywhere you are allowed to have an <input> element in HTML, you are
also allowed to have character data (like a visible greater than
symbol).  

Most, although not all, browsers get this wrong (since they use tag soup
slurpers rather than proper SGML parsers) which is why Appendix C of the
XHTML 1.0 Recommendation "works".

The document is valid and conforms to the HTML 4.01 Recommendation but
doesn't say what the author intended it to say.

It is important to keep in mind that the validator, while being a very
useful tool, is not the beginning and end of quality control for
webpages.

                        I have a spelling checker;
                        It came with my PC.
                        It plainly marks four my revue
                        Mistakes I can knot sea.
                        I've run this poem threw it;
                        I'm sore your please too no,
                        It's letter perfect in its weigh,
                        My checker tolled me sew.

-- 
David Dorward                           <http://dorward.me.uk/>
"Anybody remotely interesting is mad, in some way or another."
                             -- The Greatest Show in the Galaxy
Received on Saturday, 10 September 2005 11:54:54 GMT

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