If we have versioning, it should be in an attribute, not the doctype

If we require a version marker (and I don't necessarily agree we  
should), it should be in an attribute on the root element, not in the  
doctype string.


1) Ease of authoring and readability. Compare:

<!DOCTYPE html PUBLIC "-//W3C//HTML 5.0//EN">

<!DOCTYPE html>
<html version=5.0>

The latter is clearly easier to type correctly from memory and easier  
to read. If <!DOCTYPE html5> were usable, then that might be a better  
option from this point of view, but it triggers quirks mode in Safari  
and Firefox so it is not an option.

Some people have argued that <!DOCTYPE html> is an invalid doctype  
declaration, but that is mistaken; it is syntactically valid in both  

2) In XML, a DOCTYPE declaration is not required, and in fact is not  
recommended for languages that do not have a DTD (either because they  
don't use any formal schema language or because they use one other  
than DTDs, such as RelaxNG). For example, SVG 1.2 doesn't call for  
any DTD declaration.

3) Other modern XML-based languages use a version attribute, not  
versioning in a DTD declaration. Examples include XSLT and SVG. We  
wouldn't want the XML serialization of HTML5 to diverge from this.

4) In a compound document by inclusion (CDI) scenario, there is no  
place to put the doctype. If HTML behavior is to be versioned, then  
surely you want to apply that even when it is included directly in  
some other markup language. For instance:

<svg xmlns="http://www.w3.org/2000/svg" version="1.2">
     <html xmlns="http://www.w3.org/1999/xhtml/" version="5.0">

Where could you possibly put an html doctype declaration in this?

I think these reasons are strong enough to rule out versioning via a  
DTD declaration.


Received on Tuesday, 17 April 2007 20:51:33 UTC