weavejester / hiccup

Fast library for rendering HTML in Clojure
http://weavejester.github.io/hiccup
Eclipse Public License 1.0
2.68k stars 174 forks source link

<p /> is not valid HTML #90

Closed dg closed 10 years ago

dg commented 10 years ago

In README.md is stated:

Hiccup is intelligent enough to render different HTML 
elements in different ways, in order to accommodate browser quirks:

user=> (html [:p])
"<p />"

But <p /> in not valid HTML code.

In old HTML 4: backslash is not valid at all (it is so-called NET syntax http://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language#NET and no HTML browser recognizes it).

In new HTML 5: a "/" character may be present only if the element is a void (see http://www.w3.org/TR/html-markup/syntax.html#syntax-elements) and p is non-void element.

In XHTML 1.0: there is a HTML Compatibility Guidelines (http://www.w3.org/TR/xhtml1/#C_3), which says:

Given an empty instance of an element whose content 
model is not EMPTY (for example, an empty title or paragraph) 
do not use the minimized form (e.g. use <p> </p> and not <p />).
weavejester commented 10 years ago

Fixed in #91.