W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2011

[whatwg] Empty elements

From: Aryeh Gregor <ayg@aryeh.name>
Date: Sun, 28 Aug 2011 10:52:51 -0400
Message-ID: <CAKA+Ax=wT5SLus5yv7VpveLKSqjdh=-fpHdtGJtnxnQn6_O5fw@mail.gmail.com>
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.
Received on Sunday, 28 August 2011 07:52:51 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:08 UTC