== On the various meanings of __
With the growth of XHTML, some HTML documents have started sprouting
things of the form '__' or '__', intended to represent
empty tags. Sometimes this is due to attempts at [[XHTML to HTML
compatibility http://www.w3.org/TR/xhtml1/#guidelines]], and
sometimes it's just due to HTML superstitions. (Most people who write
HTML are not experts and have not read the [[W3C specifications
http://www.w3.org/TR/1999/REC-html401-19991224]], so superstitions are
not uncommon.)
These people and documents are making a mistake. Unfortunately, there
are three entirely separate things that __ can mean:
+ if you are actually [[successfully serving XHTML XHTMLMasochism]],
this is an empty (self-closed) element. (Hopefully it is an element
that can actually be empty.)
+ in HTML in all the major web browsers, this means '_tag_, with an
attribute called "_/_"'.
+ in strictly compliant HTML, including as parsed by the [[W3C
validator http://validator.w3.org/]], this means '_>_',
because it is actually a SGML feature called *minimization*.
The difference between validators and browsers is an especially
pernicious gotcha; a web page can pass validation, but in a completely
different way than how a browser will interpret it. (It happens because
validators usually use a real SGML parser, completely with all of the
obscure features, but browsers do not.)
It is very fortunate that no popular browser actually implements tag
minimization, because no one expects them to. Also, HTML has some
remarkably dark corners where you can get eaten by a grue.
If you want to read more about this, [[Empty elements in SGML, HTML, and
XHTML http://www.cs.tut.fi/~jkorpela/html/empty.html]] will give you all
of the detail and background that you could want. (There you will also
find a nice example of why you should always [[put attribute values in
quotes http://www.cs.tut.fi/~jkorpela/qattr.html]].)
(I owe my exposure to these pages and this issue to [[plasmaturm.org
http://plasmasturm.org/log/271/]] and [[Frank Hecker
http://www.hecker.org/blosxom/markdown-empty-element-suffix-patch]].
And in truth in advertising, the final impetus for
writing this down was provided by [[this blog entry
http://blog.sesse.net/blog/tech/2006-10-06-03-01_xhtml.html]].)