Project

General

Profile

Actions

Bug #1353

closed

HTML5 "DOCTYPE" is not capitalized

Added by Jake Petroules almost 12 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
07/09/2012
Due date:
% Done:

0%

Estimated time:

Description

Wt currently outputs <!doctype html>; this should be <!DOCTYPE html>...

While the HTML5 spec indicates that the "DOCTYPE" is case INsensitive (http://dev.w3.org/html5/spec/single-page.html#the-doctype), for polyglot documents (i.e. a document that is both valid HTML5 and XHTML5 simultaneously), the "DOCTYPE" MUST be capitalized: http://dev.w3.org/html5/html-xhtml-author-guide/#doctype

Therefore, for maximum compatibility we should use the uppercase version; a patch is attached.


Files

doctype-patch.diff (410 Bytes) doctype-patch.diff Jake Petroules, 07/09/2012 10:44 PM
Actions #1

Updated by Koen Deforche almost 12 years ago

  • Status changed from New to Feedback
  • Assignee set to Koen Deforche

Hey Jake,

With the advent of HTML5, we no longer have a need for serving the application as "application/xhtml+xml", since HTML5 allows inclusion of inline SVG.

Therefore, we believe that although Wt indeed renders polyglot "html/xml", mainly because this allows us to use an XML parser internally, browsers can really treat it as plain HTML, and if possible we prefer to stick with the most used features of a browsers since they tend to have enough bugs already :-)

Regards,

koen

Actions #2

Updated by Jake Petroules almost 12 years ago

Again, the capitalized version is the one that is compatible with everything, and is the one that is used in official W3C examples, and by most web developers in the field. So I think that for consistency it makes more sense to use the uppercase version, which has no problems at all, rather than the lowercase version, which has some issues in certain circumstances, as noted.

I'm not proposing a MIME type change or any change that would result in changing the behavior of browsers or trigger any bugs - just a capitalization fix for maximum compatibility. :)

Actions #3

Updated by Wim Dumon almost 12 years ago

Changing doctype from HTML to XHTML is indeed something that we had problems with in the past. It has all kind of weird consequences on visual aspects of DOM elements, CSS defaults, and God knows what more... I tend to agree with Koen in the sense that if it ain't broken, we should not fix it.

You're talking about issues with small case doctype. Can you provide some pointers to problems we can expect? As written in the link you provide, it seems that Wt is perfectly HTML5 compatible.

Actions #4

Updated by Jake Petroules almost 12 years ago

Again, I'm not proposing a change of doctype from HTML to XHTML - merely a capitalization change that is compatible with both of them rather than just one of them. Also, if you want to consider weird consequences, consider the fact that virtually every HTML5 website out there uses <!DOCTYPE html>.

Wt is actually the only toolkit or website I've seen (except for around 1 or 2 others), ever, that use <!doctype html> - this is actually invalid XML as doctype is required to be capitalized.

But again, the capitalized version is the only one that is compatible across everything. There are no problems whatsoever with <!DOCTYPE html> for plain HTML. In fact if there were any problems I would expect <!doctype html> to be the one that triggers them, if anything.

I'm just not understanding you folks' reasoning for being against this change when the goal is to avoid potential issues. I could completely understand your opposition were this discussion centric to HTML4 and XHTML 1.x doctypes, where the situation is completely different and which most certainly do make a huge difference in browser behavior.

However HTML5 and XHTML5 share the exact same doctype. The ONLY difference is that HTML5 allows the "DOCTYPE" word to be lowercase. Just because this is allowed doesn't mean this version should be used. Browsers treat a document as HTML5 or XHTML5 depending on the MIME type of the document sent by the server - the doctype is irrelevant in the standard casing format, <!DOCTYPE html>. Again, the only problem arises if a document is served with an XML mime type (e.g. application/html+xml) and the "DOCTYPE" keyword is lowercase. That is what this patch fixes. There are absolutely no other implications. Because this change will ONLY affect documents served with an XML MIME type, we need not worry about documents served with a plain HTML mime type. It will not affect that at all.

In summary, for HTML, casing is irrelevant in the doctype, for XHTML casing is required to be exactly as such: <!DOCTYPE html>. So why not use that version like everyone else? There are no drawbacks.

Actions #5

Updated by Koen Deforche almost 12 years ago

  • Target version set to 3.2.3

Hey Jake,

I don't know where I got the impression that <!doctype html> was what everybody was using, but it seems that indeed most people are using <!DOCTYPE html>. In that case, yes, we should probably follow suit.

Regards,

koen

Actions #6

Updated by Jake Petroules over 11 years ago

Nitpick: "hoeray" is still spelled wrong. It should be "hooray". :)

Actions #7

Updated by Koen Deforche over 11 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF