From ca0aa9533f7c3a925f1115581872793bdf34bb34 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 7 Jun 2010 02:18:31 +0200 Subject: [PATCH] Added an HTML FAQ document, first draft. --- docs/contents.rst.inc | 1 + docs/htmlfaq.rst | 162 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 docs/htmlfaq.rst diff --git a/docs/contents.rst.inc b/docs/contents.rst.inc index 9a3ff5a8..2422d12e 100644 --- a/docs/contents.rst.inc +++ b/docs/contents.rst.inc @@ -40,6 +40,7 @@ Design notes, legal information and changelog are here for the interested. :maxdepth: 2 design + htmlfaq extensiondev license upgrading diff --git a/docs/htmlfaq.rst b/docs/htmlfaq.rst new file mode 100644 index 00000000..b92beb77 --- /dev/null +++ b/docs/htmlfaq.rst @@ -0,0 +1,162 @@ +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 ``Hello`` but because existing websites are using +pseudo-XHTML which uses the Slash in different ways, this could not be +implemented properly. + +In 2007 the specification was adopted as the basis of a new HTML +specification under the umbrella of the W3C. Currently it looks like +XHTML is losing traction, the XHTML 2 working group was disbanded and +HTML5 is being implemented by all major browser vendors. + +HTML versus XHTML +----------------- + +The following table gives you a quick overview of features available in +HTML 4.01, XHTML 1.1 and HTML5 (we are not looking at XHTML 1.0 here which +was superceeded by XHTML 1.1 or XHTML5 which is barely supported currently): + ++-----------------------------------------+----------+----------+----------+ +| | HTML4.01 | XHTML1.1 | HTML5 | ++=========================================+==========+==========+==========+ +| ``value`` | |Y| [1]_ | |N| | |N| | ++-----------------------------------------+----------+----------+----------+ +| ``
`` supported | |N| | |Y| | |Y| [2]_ | ++-----------------------------------------+----------+----------+----------+ +| ``