Re: [cowan@mercury.ccil.org: Questions about HTML void elements]

On 01/20/2011 12:01 PM, John Cowan wrote:
> These are (some of) my beliefs about HTML void elements.  Can someone
> indicate whether any of them are false?
>
> 1) There are 14 void elements, namely area, base, br, col, command,
>     embed, hr, img, input, keygen, link, meta, param, and source.

 From http://www.w3.org/TR/html5/syntax.html#elements-0 :

area, base, br, col, command, embed, hr, img, input, keygen, link, meta, 
param, source, track, wbr

Not that this list includes track and wbr.

> 2) The form "<br>" is valid HTML.

Correct.

> 3) The form "<hr>" is valid HTML.

Correct.

> 4) The form "<br/>" is *invalid* HTML.

Incorrect.  See step 6:

http://www.w3.org/TR/html5/syntax.html#start-tags

> 5) The form "<br/>" means the same as"<br>".

Correct.

> 6) The form "<hr/>" is *invalid* HTML.

Incorrect.

> 7) The form "<hr/>" means the same as"<hr>".

Correct.

> 8) The form "<br></br>" is *invalid* HTML.

Correct.

> 9) The form "<br></br>" means the same as"<br><br>".

Correct.  *sigh*

> 10) The form "<hr></hr>" is *invalid* HTML.

Correct.

> 11) The form "<hr></hr>" means the same as"<hr>".

Correct. (module a parse error, which generally is never presented to, 
well, pretty much anybody)

> 12) All other void elements behave like hr.

Correct.  Note that this is the subject of an open issue:

http://www.w3.org/html/wg/tracker/issues/156

> 13) The list of void elements will never grow.

I know of no such guarantee.  It just seems likely that future void 
elements will more likely behave like hr (or, depending on the 
resolution of issue 156, outright permit explicit close tags)

- Sam Ruby

Received on Thursday, 20 January 2011 17:40:57 UTC