[whatwg] self-closing tags in html5

William F Hammond hammond at csc.albany.edu
Mon Sep 27 10:14:27 PDT 2010

Bjoern Hoehrmann <derhoermi at gmx.net> writes:

> * William F Hammond wrote:
>>Does anyone seriously think that "<foo/>" is an ordinary open tag?
> They do if it's like in `<a href=http://example.org/>`.

Well, the spec (w3 version) has detailed parsing rules for text/html
in section 8.2.  I _think_ those rules would understand the last '/'
in this example to be part of an unquoted value string.  If I'm right
about that, the parsing rules would NOT say that the self closing flag
should be set for this example.  In fact, I see that validator.nu
accepts this example.

My suggestion is that when the parsing rules say the self-closing
flag _should_ be set (which Henri Sivonen's validator.nu seems to
be clear about), browsers should close off the element whether it
is foreign or html.

This validator.nu message

  Error: Self-closing syntax (/>) used on a non-void HTML element.
         Ignoring the slash and treating as a start tag.

represents the cognitive dissonance that I think is a problem.
(See http://math.albany.edu/pers/hammond/Test/leaptag.html)

                                    -- Bill

More information about the whatwg mailing list