HTML/XHTML FAQ
==============
The Flask documentation and example applications are using HTML5. You
will notice that in many situations when end tags are optional they are
not used to keep the HTML cleaner and also faster to load. Because there
is a lot of confusion about HTML and XHTML out there this document tries
to answer some of them.
History on XHTML
----------------
For a while it looked like HTML was about to be replaced by XHTML.
However barely any websites on the internet are actually real XHTML (which
means XHTML processed with XML rules). There are a couple of reasons why
this is the case. It mostly has to do with Internet Explorer which does
not accept the XHTML mimetype to switch the browser into XML mode.
However this is really easy to bypass but barely anyone does that. This
probably has to do with the fact that XHTML is really painful.
Why is it painful? XML has very strict errorhandling. On a parsing error
the browser is supposed to show the user an ugly error message. Most of
the (X)HTML generation on the web is based on non-XML template engines
(such as Jinja, the one used in Flask) which do not protect you from
accidentally creating invalid HTML. There are XML based template engines
but they usually come with a larger runtime overhead and are not as
straightforward to use because they have to obey XML rules.
Now the majority of users assumed they were using XHTML though. The
reasons for that is that they sticked an XHTML doctype on top of the
document and self-closed all necessary tags (``
`` becomes ``
`` or
``
`` in XHTML). However even if the document properly validates
as XHTML there are still other things to keep in mind.
XHTML also changes the way you work with JavaScript because you now have
to use the namespaced DOM interface with the XHTML namespace to query for
HTML elements.
History of HTML5
----------------
HTML5 was started in 2004 under the name Web Applications 1.0 by the
WHATWG (Apple, Mozilla, Opera) and the idea was to write a new and
improved specification of HTML based on actual browser behaviour instead
of behaviour that exists on the paper but could not be implemented
because of backwards compatibility with the already existing web.
For example in theory HTML4 ``