[whatwg] Using the HTML5 DOCTYPE as a new quirksmode switch

Mihai Sucan mihai.sucan at gmail.com
Sun Mar 11 04:39:25 PDT 2007


Le Sun, 11 Mar 2007 00:51:30 +0200, WHATWG <whatwg at robertdot.org> a écrit:

> On Mar 10, 2007, at 8:38 AM, Mihai Sucan wrote:
>
>> There's no way to advertise the document as HTML 5, and it's
>> certainly not the purpose of the specification to do so.
>
> This is a problem.  It is especially a problem now that the W3C is
> working on their version of HTML 5.  When I asked Ian Hickson how
> WHATWG would handle divergence in the W3C spec [1], he said he
> "intended to make every effort to keep the two in sync." [2]  While I
> appreciate his effort and I fully believe that he will do his best,
> we are dealing with a body (i.e. the W3C) who have a history of
> stubbornness and unwillingness to work with important members of the
> community. [3]  The future is still undecided, but I don't think it
> is a good idea to operate under the assumption that the W3C will copy
> and paste the entire WHATWG HTML 5 spec.

Yes, this is going to be very interesting. If we will end-up having two  
separate HTML 5 specs, then The Web will be at loss. Stubborness should  
not have any place in HTML 5.

> It seems the WHATWG is staunchly against DTDs, even if it has an
> appropriate use (e.g. emails in this thread talking about XML
> entities).  I've mulled over this awhile.  Since DTDs aren't
> normative in browsers, perhaps a "link" element with a
> "rel=specification" and an "href=http://www.whatwg.org/specs/web-apps/
> current-work/" (for example) would be a new way to say, "this is the
> specification I used to create this document."  It is easier to
> remember than the DOCTYPE DTDs on pervious versions of HTML, and it
> is much more human-readable than DTDs.  It addresses my concerns, and
> doesn't use DTDs.

No, adding yet another way to inform the UA about the type of document is  
not good. So, no, I don't think using HTTP headers, or "link" elements, is  
good.

Let me make some points.

Say we have the version attribute, as suggested, on the <html> tag (the  
root tag), or we have the suggested HTTP header, or we have the "link"  
element, or a specific DTD, or whatever - it doesn't really matter. It's  
false to assume the UA developers can happily say "now we'll parse HTML5,  
lets use our new HTML5 parser". No, this won't happen. Here's why: the UA  
cannot be sure that the document is *really* HTML 5. The UAs (most notably  
the web browsers: Opera, Gecko, Safari, I-Etc), will continue to use their  
wild guessing technniques, their error recovery algorithms, and parsing  
rules. If they encounter supported tags/attributes/code defined in the  
HTML5 spec, they'll just use them. This is happening today in Opera 9: the  
Web Forms 2 implementation does not use any versioning, any specific DTD.  
The UA does not need to know if the document will contain WF2 or not.  
However, if it does find <input type="email"> then *that* will be used.  
Same goes for HTML5.

Also, web developers will never be able to rely on the fact that UAs will  
stop parsing the document if HTML5 is not supported (heck, that's not the  
purpose, *we* actually want older browsers to be able to use new HTML5  
documents). Next, web developers cannot expect that the UA will support  
all the HTML5 features. For example, they'll still need to check for the  
existence of each new DOM property/method.

So, I ask you: what use is then a DTD, a version attribute, or any  
indication that the document is written with HTML5 in mind? It's  
practically useless. The UAs will completely ignore it, if it would exist  
(at least for the moment - the future is still subject to change :) ).

By adding such indications we only create false expectations to  
beginners/noobs/non-experts.  They will create broken pages that rely on  
such indications.


> Now, I don't know if it can be used as a quirksmode switch.  The
> DOCTYPE seems like an ideal place to run the switch.  The problem
> will be if the W3C (or some other as yet unformed working group that
> decides to fork HTML) doesn't implement a DTD-less DOCTYPE.  If the
> switch is the WHATWG HTML5 DOCTYPE, documents authored under W3C HTML
> 5 spec will not render in super-standard mode.  Browsers will have to
> have multiple super-standards modes switches depending on what
> version of HTML5 the author uses.

I think it's too early to talk about W3C HTML5 versus WHATWG HTML5. We  
shall wait and see.

> IE asking a working group to provide some new way to specify
> standards mode doesn't make sense.  That is an implementation problem
> that they need to figure out.  It isn't our job to write their
> software.  WHATWG doesn't need to bloat the spec for them.  The IE
> team needs to be creative and find a solution to their problem.

I don't remember them *asking* a WG for such solutions. This is only a  
proposal made by the initial author of the thread.

Agreed, Microsoft needs to be creative (not evil) and find a solution.

> We're already using headers to swap between HTML and XHTML (since we
> still call both .html files).  Headers are for telling user agents
> how to deal with content.  It seems like sending a header "X-
> STANDARDS-MODE: HTML5;" (or "WHATWG-HTML5" if W3C's HTML 5 is
> significantly different) or setting an http-equiv meta tag to tell IE
> to use their super-standards mode is cleaner and more desirable as it
> doesn't bloat the spec, and should be more than enough for them.  If
> their standards mode for HTML5 has flaws and they need a NEW switch,
> it can be changed to "X-STANDARDS-MODE: HTML6;" or whatever the
> latest version of HTML is.  This can be set across an entire server
> in a few seconds via config files if needed, or set on a single
> folder via .htaccess files.  If headers are used, that also doesn't
> bloat the file if is is saved on someone's HDD.

This is not an elegant solution. I would actually this like it.


I like what Sean Fraser said in a WHATWG blog post: "[HTML5] is  
philosophically different, that's all" [1]. I believe this single last  
paragraph in the blog post made a good point in defining HTML5.



[1] http://blog.whatwg.org/what-makes-the-application-of-html-5-different


-- 
http://www.robodesign.ro
ROBO Design - We bring you the future



More information about the whatwg mailing list