[whatwg] self-closing tags in html5
ian at hixie.ch
Thu Dec 30 23:18:52 PST 2010
On Sat, 25 Sep 2010, William F Hammond wrote:
> In the spec at 22.214.171.124 (6) (for the text/html serialization):
> Then, if the element is one of the void elements, or if the
> element is a foreign element, then there may be a single U+002F
> SOLIDUS character (/). This character has no effect on void
> elements, but on foreign elements it marks the start tag as
> It would be better to allow self-closing tags on all de facto empty
> elements, foreign or not and defined-empty or not.
you further clarify "de facto empty" as meaning:
| A defacto empty element is an element that is either defined-empty in
| the document type definition OR any element in the current document
| instance that has no content.
While syntactic sugar to make "<foo/>" equivalent to "<foo></foo>" even
for elements that are not void elements would probably be quite popular,
it is unfortunately incompatible with legacy content. It turns out that
there is a large amount of content that includes "/" characters in
positions that appear to be the end of the start tag but that do not
intend to have the browser close the element immediately.
For example, markup such as the following is sadly common:
I have therefore not changed the spec in response to this request.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg