Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert back to <!doctype html> ? #1522

Closed
alrra opened this issue Mar 22, 2014 · 18 comments
Closed

Revert back to <!doctype html> ? #1522

alrra opened this issue Mar 22, 2014 · 18 comments
Milestone

Comments

@alrra
Copy link
Member

alrra commented Mar 22, 2014

Previous discussions

Commit in which the change was made: 7a2f9dc
Relevant issues: #335, #1059.

Specification, browsers and validators

From WHATWG

A DOCTYPE must consist of the following components, in this order:

  1. A string that is an ASCII → case-insensitive ← match for the string "<!DOCTYPE".
  2. One or more space characters.
  3. A string that is an ASCII → case-insensitive ← match for the string "html".
  4. Optionally, a DOCTYPE legacy string or an obsolete permitted DOCTYPE string (defined below).
  5. Zero or more space characters.
  6. A U+003E GREATER-THAN SIGN character (>).

In other words, , case-insensitively.

So, according to the specification, the case doesn't matter. Also, browsers (AFAIK) don't really care, and the W3C validator is fine with either case.

Pros and cons for using <!doctype html>

Pros:

Cons:

  • some IDEs/text editors complain about the syntax (IMHO this shouldn't be a concern for H5BP, as it represents a bug in the IDE/text editor, and thus, it should be fixed by them. Going on this path, one can argue that we shouldn't use CSS3 features because some IDEs/text editors complain about the new syntax).
  • the uppercase form is more commonly used, and thus, it doesn't make developers wonder/curious.

Thoughts?

@roblarsen
Copy link
Member

I thought of this as soon as I read that compression article.

@mathiasbynens
Copy link
Member

Note that the “compresses better” argument is a generalization – it assumes that throughout the rest of the document, the lowercase document characters are more common than uppercase DOCUMENT characters. This may not be true for all documents.

“may spark the developer's curiosity” is subjective – you could say the same thing about <!DoCtYpE hTmL>.

Another reason pro uppercase is polyglot/XHTML compatibility (although XHTML is not something anyone actively wants to support).

@alrra alrra changed the title Revert back to using <!doctype html> Revert back to using <!doctype html> ? Mar 22, 2014
@necolas
Copy link
Member

necolas commented Mar 22, 2014

The compression of 'doctype' vs 'DOCTYPE' is never going to matter.

@koistya
Copy link

koistya commented Mar 23, 2014

Having DOCTYPE uppercase will keep it consistent with its mentions in docs on WHATWG.

@QWp6t
Copy link
Contributor

QWp6t commented Mar 23, 2014

Having doctype lowercase will keep it consistent with @paulirish.

CHECKMATE checkmate.

@drublic
Copy link
Member

drublic commented Mar 24, 2014

I would be in favor of leaving the doctype as it is, in upper case. There is not a lot of value for any other variant.

@drublic drublic added this to the 5.0.0 milestone Mar 24, 2014
@exside
Copy link

exside commented Mar 24, 2014

@mathiasbynens I also think the uppercase variant has a slight advantage, as you said, probably not bc somebody wants to support polyglot/XHTML whatever =)...but any xml parser could parse a HTML document with an uppercase doctype while a lower or mixed case one would throw a parse error...not that a lot of people would extensively parse html documents with XML parsers (and also the rest of the tags should then be XHTML compatible, eg. self closing etc.) but who knows when you will, so I don't see anybody hurt due to an uppercase doctype but in the described case that would be possible...at least that's how I understood it =)

@alrra alrra closed this as completed Mar 24, 2014
@paulirish
Copy link
Member

some IDEs/text editors complain about the syntax

Cant find evidence of this now, as I think it's been resolved.
Textmate 2: no problem. ST2: no problem. WebStorm 7: no problem. Atom: all good.

So given that, there are no serious reasons we would avoid lower-case.

H5BP rejected supporting polyglot documents a long time ago, it's not worthwhile to try to support it at doctype level and then ignore support for the rest.

I think the lowercase doctype is consistent with the lower-case of the html tags used. Beyond consistency, uppercase is loud, obnoxious and isn't a calm introduction into the HTML source. Google uses the lowercase doctype, along with hundreds of thousands of sites built with earlier h5bp versions.

@QWp6t
Copy link
Contributor

QWp6t commented Mar 24, 2014

@exside that would make it inconsistent with some of the other decisions made by h5bp. You mentioned self-closing tags, for example; h5bp does not have self-closing tags. If doctype should be uppercase for the purpose of being compatible with xml, then everything else should be xml compatible as well.

This isn't intended to say that there are zero reasons for using uppercase, only that the reason you've brought up is an invalid one, or at least inconsistent with some of the other decisions h5bp has made.

@alrra alrra reopened this Mar 24, 2014
@exside
Copy link

exside commented Mar 25, 2014

@QWp6t from that point of view, you're definitely right =)...i use my "own" crafted base template which for sure got a good amount of best practices form h5bp, so I didn't have that "pure" h5bp thing in mind when writing that comment, but I liked the strictness of XHTML somehow and thus I'm still writing in an XHTML compliant way (e.g. with self closing tags etc.)

@alrra alrra self-assigned this Mar 31, 2014
@drublic
Copy link
Member

drublic commented Apr 1, 2014

What's the conclusion here? I still don't see reasons to change the doctype.

@alrra
Copy link
Member Author

alrra commented Apr 1, 2014

I still don't see reasons to change the doctype.

@drublic for me, the main reason for this change is that it feels more consistent with the rest of the code.

@sarukuku
Copy link

sarukuku commented Apr 1, 2014

I think the lowercase doctype is consistent with the lower-case of the html tags used. Beyond consistency, uppercase is loud, obnoxious and isn't a calm introduction into the HTML source. Google uses the lowercase doctype, along with hundreds of thousands of sites built with earlier h5bp versions.

Considering the above comment from @paulirish I think I'll vote for the change.

@roblarsen
Copy link
Member

@alrra Yes, I'm a for

@koistya
Copy link

koistya commented Apr 1, 2014

I think the lowercase doctype is consistent with the lower-case of the html tags used.

And the other way around, the upper-case will differentiate DOCTYPE declaration string (preamble) from regular html tags.

My 👍 for <!DOCTYPE html>

@alrra alrra changed the title Revert back to using <!doctype html> ? Revert back to <!doctype html> ? Apr 2, 2014
@alrra alrra changed the title Revert back to <!doctype html> ? Revert back to using <!doctype html> ? Apr 2, 2014
@alrra alrra changed the title Revert back to using <!doctype html> ? Revert back to <!doctype html> ? Apr 2, 2014
@alrra
Copy link
Member Author

alrra commented Apr 2, 2014

Thank you all for your feedback!

@alrra alrra closed this as completed in e67e9cc Apr 2, 2014
@alrra
Copy link
Member Author

alrra commented Apr 2, 2014

If anyone is interested in some stats:

(:warning: please keep in mind that those numbers are not necessarily representative for actual pages with content, so treated them just as fun stats!)


404.html
  • 404.html using <!DOCTYPE html>

    original size:         1242 B
    gzipped size:           580 B
    ─────────────────────────────
    reduction:              662 B [53.3%]
    
  • 404.html using <!doctype html>

    original size:         1242 B
    gzipped size:           574 B
    ─────────────────────────────
    reduction:              668 B [53.8%]
    

index.html
  • index.html using <!DOCTYPE html>

    original size:         1760 B
    gzipped size:           879 B
    ─────────────────────────────
    reduction:              881 B [50.1%]
    
  • index.html using <!doctype html>

    original size:         1760 B
    gzipped size:           875 B
    ─────────────────────────────
    reduction:              885 B [50.3%]
    

alrra added a commit that referenced this issue Apr 2, 2014
Return back to the lowercase doctype in order to be more consistent
with the lowercase of the html tags.

References:

  * #1522
  * http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#the-doctype

Close #1522.
ericwbailey added a commit to ericwbailey/sublime-snippets that referenced this issue Feb 9, 2015
rlovtangen added a commit to rlovtangen/grails-profile-repository that referenced this issue Feb 18, 2015
gitgrimbo added a commit to gitgrimbo/harviewer that referenced this issue Jun 21, 2015
IE9 needs standards mode for standard implementation of
document.querySelectorAll.

- http://stackoverflow.com/a/18404789/319878

Modernise the doctype according to html5-boilerplate:

- h5bp/html5-boilerplate#1522
- h5bp/html5-boilerplate@e67e9cc
woneob added a commit to woneob/jekyll that referenced this issue Nov 5, 2015
HTML5 the doctype declaration is case-insensitive but here's some reason.
Please check this issue  h5bp/html5-boilerplate#1522

And some popular HTML boilerplate also use a lowercase doctype.
- html5-boilerplate: https://github.com/h5bp/html5-boilerplate/blob/master/src/index.html#L1
- Web Starter Kit: https://github.com/google/web-starter-kit/blob/master/app/index.html#L1

and google.com too.
woneob added a commit to woneob/jekyll that referenced this issue Nov 5, 2015
HTML5 the doctype declaration is case-insensitive but here's some reason.
Please check this issue  h5bp/html5-boilerplate#1522

And some popular HTML boilerplate also use a lowercase doctype.
- html5-boilerplate: https://github.com/h5bp/html5-boilerplate/blob/master/src/index.html#L1
- Web Starter Kit: https://github.com/google/web-starter-kit/blob/master/app/index.html#L1

and google.com too.
woneob added a commit to woneob/jekyll that referenced this issue Nov 5, 2015
HTML5 the doctype declaration is case-insensitive but here's some reason.
Please check this issue  h5bp/html5-boilerplate#1522

And some popular HTML boilerplate also use a lowercase doctype.
- html5-boilerplate: https://github.com/h5bp/html5-boilerplate/blob/master/src/index.html#L1
- Web Starter Kit: https://github.com/google/web-starter-kit/blob/master/app/index.html#L1

and google.com too.
Kovah pushed a commit to Kovah/InvoicePlane that referenced this issue Nov 24, 2015
Standardized the HTML5 doctype declarations across the app.
Lower case was chosen to stick to the standards in HTML5 boilerplate.

HTML5 Boilerplate: https://github.com/h5bp/html5-boilerplate
Doctype Discussion:
h5bp/html5-boilerplate#1522
eleanor-byhook pushed a commit to eleanor-byhook/html5-boilerplate that referenced this issue Feb 29, 2016
Return back to the lowercase doctype in order to be more consistent
with the lowercase of the html tags.

References:

  * h5bp/html5-boilerplate#1522
  * http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#the-doctype

Close h5bp/html5-boilerplate#1522.
jameskleeh pushed a commit to grails-profiles/web that referenced this issue Jul 5, 2016
robert-claypool pushed a commit to cumberland-river-compact/icreek that referenced this issue Jul 5, 2018
brightmanforever022 added a commit to brightmanforever022/invoice-codeigniter that referenced this issue Jan 31, 2023
Standardized the HTML5 doctype declarations across the app.
Lower case was chosen to stick to the standards in HTML5 boilerplate.

HTML5 Boilerplate: https://github.com/h5bp/html5-boilerplate
Doctype Discussion:
h5bp/html5-boilerplate#1522
kranthi186 added a commit to kranthi186/invoice-codeigniter that referenced this issue Feb 2, 2023
Standardized the HTML5 doctype declarations across the app.
Lower case was chosen to stick to the standards in HTML5 boilerplate.

HTML5 Boilerplate: https://github.com/h5bp/html5-boilerplate
Doctype Discussion:
h5bp/html5-boilerplate#1522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants