[whatwg] Allow trailing slash in always-empty HTML5 elements?

Lachlan Hunt lachlan.hunt at lachy.id.au
Wed Nov 29 06:42:02 PST 2006

Sam Ruby wrote:
> In HTML5, there are a number of elements with a content model of empty: 
> area, base, br, col, command, embed, hr, img, link, meta, and param.
> If HTML5 were changed so that these elements -- and these elements alone 
> -- permitted an optional trailing slash character, what percentage of 
> the web would be parsed differently?  Can you cite three independent 
> examples of existing websites where the parsing would diverge?

If it's only allowed on empty elements (now known as "singleton 
elements" in the spec) then this isn't about changing the handling, it's 
just about defining what is and is not conforming.

I do not think it's a good idea to make the trailing slash conforming. 
Although it is harmless, it provides no additional benefit at all and it 
creates the false impression that the syntax actually does something.

The fact is that authors already try things like <div/>, <p/> and even 
<a/>.  I've seen all of those examples in the wild.  See, for instance, 
the source of the XML 1.0 spec (and many others) which claim to be XHTML 
as text/html, littered with plenty of <a/> tags all throughout.

I've even come across various authors either thinking that does work, or 
(when they find out the truth) wondering why it doesn't.  It's not a 
good idea to confuse them any more by giving the impression that it 
works for some elements but not others.  It's better to just say it 
doesn't work at all and forbid it in all cases.

> and all this is coupled with Lachlan's observations[3] on what it 
> would take to change the popular WordPress application to produce 
> HTML5 compliant output.

That just illustrates a fundamental flaw in the way WordPress has been 
built.  It is a perfect example of a CMS built by a bunch of bozos [1] 
and cannot be used as an excuse for allowing the syntax.

> As a side benefit of this change, I believe that I could modify my 
> weblog to be simultaneously both HTML5 and XHTML5 compliant, modulo the 
> embedded SVG content, something that would needs to be discussed 
> separately.

No you couldn't, and how would that be a benefit if you could?  XHTML 5 
requires xmlns, HTML 5 forbids it.  HTML 5 requires <!DOCTYPE html>, 
XHTML 5 doesn't (though it's still well-formed, so you could get away 
with it).

[1] http://hsivonen.iki.fi/producing-xml/

Lachlan Hunt

More information about the whatwg mailing list