[whatwg] Empty elements

Aryeh Gregor ayg at aryeh.name
Sun Aug 28 07:52:51 PDT 2011


On Sun, Aug 28, 2011 at 12:26 AM, Jukka K. Korpela <jkorpela at cs.tut.fi> wrote:
> The word "void", though used even in the validator's message, is at least
> misleading if not incorrect. The correct word is "empty".

"Void" is correct:

http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#void-elements

> The interesting question is: Where do the normative rules say that
> self-closing syntax must not be used for other than empty elements?

http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#start-tags

> The XHTML serialization rules say, at
> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#the-xhtml-syntax
> as follows:

Those are relevant only to documents served with an XML MIME type.
Documents served with a text/html MIME type must obey the HTML syntax
rules, not XHTML.  I couldn't find where the spec says this
normatively, but there's an informative note at the top of the HTML
syntax and XHTML syntax sections.

If you're serving a document with an XML MIME type, <foo></foo> is
equivalent to <foo /> for any value of foo.  The validator won't
distinguish and neither will UAs, so use whichever you please.
They're entirely different with an HTML MIME type, and that cannot be
changed at this point due to compatibility.



More information about the whatwg mailing list