Re: What is wrong with <td/>?

On 17 Sep 2015, at 13:59, Roger W Haworth wrote:

> In this page for example I use lots of self-closing <td/>s. When I declare the doctype to be HTML5 the validator says:
> Self-closing syntax (/>) used on a non-void HTML element. Ignoring the slash and treating as a start tag.
> I cannot see anything wrong with <td/>. Please tell the validator to stop rejecting it.

The specification only [allows the `/` character][1] at the end of start tags for [void elements][2] (where, in the HTML serialisation, it has no effect other than to satisfy people with an XML addiction) and foreign elements. `td` is clearly not listed among the the void elements and, being defined by HTML, it isn't a foreign element either.

The validator is correct.

[1]: http://www.w3.org/TR/html5/syntax.html#start-tags
[2] http://www.w3.org/TR/html5/syntax.html#void-elements

-- 
David Dorward
http://dorward.co.uk/

Received on Friday, 18 September 2015 13:06:13 UTC