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

Le 30 nov. 2006 ? 16:46, Sam Ruby a ?crit :

> On 11/30/06, Michel Fortin <michel.fortin at michelf.com> wrote:
>
>> 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.
>
> Why not?

It seems I was mistaken about that. I was pretty sure that it'd be a  
parse error in XML, but I now look at the [DTD construct in the XML  
spec][1] and I cannot see why. Apparently this is a valid DTD for an  
XML document where the root element is <html>:

     <!DOCTYPE html>

These wouldn't since XML is case-sensitive:

     <!DOCTYPE HTML>
     <!doctype html>

  [1]: http://www.w3.org/TR/REC-xml/#dtd

So it appears after all that if HTML allows "/>", it would be  
possible and practical to have a single document which is valid for  
both HTML and XHTML at the same time. That doesn't mean the document  
will behave in the same way in the two cases however.

I wonder if allowing "/>" in HTML couldn't, on the opposite of some  
other arguments, help authors and developers to grasp the real  
difference between the two markups. Currently, "/>" is the signature  
of XHTML; people have learned that you add "/>" to HTML documents to  
make them XHTML. If HTML embrace the "/>" syntax, then that  
misleading hint no longer holds and people will have to learn to  
differentiate HTML from XHTML using other means (hint: media type!).  
They wouldn't really need to relearn anything if they don't want to,  
they'll just take note that "/>" doesn't necessarily mean XHTML  
anymore and that their valid XHTML1 documents served as text/html,  
when updated to XHTML5, are now called valid HTML5 documents by the  
validator.

Does this scenario makes any sense?


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

Received on Thursday, 30 November 2006 18:15:55 UTC