Commits  committed 910d682

Add an explanation about the HTML builder and how/why it produces <br />, etc.

  • Participants
  • Parent commits ef5af49

Comments (0)

Files changed (1)

File webhelpers/html/

 keyword (particularly ``class``), you can append an underscore and
 it will be removed (like ``class_='whatever'``).
+About XHTML and HTML
+This builder always produces tags that are valid as *both* HTML and
+XHTML.  "Empty" tags (like ``<br>``, ``<input>`` etc) are written like ``<br />``,
+with a space and a trailing ``/``.
+*Only* empty tags get this treatment.  The library will never, for example,
+product ``<script src="..." />``, which is invalid HTML.
+The `W3C HTML validator <>`_ validates these
+constructs as valid HTML Strict.  It does produce warnings, but those
+warnings warn about the ambiguity if this same XML-style self-closing
+tags are used for HTML elements that can take content (``<script>``,
+``<textarea>``, etc).  This library never produces markup like that.
+Rather than add options to generate different kinds of behavior, we
+felt it was better to create markup that could be used in different
+contexts without any real problems and without the overhead of passing
+options around or maintaining different contexts, where you'd have to
+keep track of whether markup is being rendered in an HTML or XHTML
 import re
 from cgi import escape as cgi_escape