[whatwg] Allow trailing slash in always-empty HTML5 elements?

Michel Fortin michel.fortin at michelf.com
Thu Nov 30 13:16:54 PST 2006


Le 30 nov. 2006 à 15:21, Elliotte Harold a écrit :

> Michel Fortin wrote:
>
>> What is really important is that authors understand better that  
>> HTML must be served as text/html and that XHTML must be served  
>> with an xml media type. If the validator enforce that, then I  
>> think it'll be sufficient.
>
> That's only plausible if
>
> 1. All browsers that accept XHTML served as text/html accept XHTML  
> served as application/xhtml+xml.
>
> 2. Document authors can control the MIME types their documents are  
> served with.
>
> Neither is true today. Neither is likely to be true within the next  
> couple of years, probably longer. They should be true by all means,  
> but they aren't.
>
> Given that fact of the installed base, I cannot accept that it is  
> wrong to serve XHTML as text/html, and I'm afraid any effort that  
> depends critically on that happening is doomed.

These are valid point, but I think you just misunderstood me. I could  
have said it this way: HTML must be served in a way that it is parsed  
by an HTML parser, and XHTML must be served in a way that it is  
parsed by an XML parser. That's the only sane thing you can do, and I  
don't really care if you do that by other means than the HTTP Content- 
Type header.

Now, when you're talking about "XHTML", you could be talking about  
two things. I'm talking an XML document, a format where <div/> is  
equivalent to <div></div>. You just can't send that to an HTML parser.

If you're talking about HTML where you added "/>" at the end of  
singleton tags to make it compatible with XHTML, then you've just  
misunderstood me. I wasn't arguing against "/>" in HTML. If HTML  
allows "/>" on singleton tags, <img src="..." /> becomes both valid  
HTML and XHTML. If it wasn't for the doctype, you could serve it with  
any of the two media types (assuming the scripts and other things  
work with XHTML too, of course).

So if a document is meant to be parsed by the HTML parser, it's an  
HTML document; if it's meant to be parsed by the XML parser, it's an  
XHTML document; and if it can be parsed by both, then it's both.

We can't really have a document that is both HTML5 and XHTML5 at the  
same time if we keep the <!DOCTYPE HTML> declaration however. I'm not  
sure that's really a problem though, and it may even be a good thing  
since it's pretty easy to change the doctype if you want -- a lot  
easier than changing every singleton tags -- but you have to make the  
change explicitly in the source, so when an error arises it'll be  
easier to link it to a HTML/XHTML issue.


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/





More information about the whatwg mailing list