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

Use lowercase doctype #822

Closed
ngyikp opened this issue Jun 3, 2017 · 10 comments · Fixed by #944
Closed

Use lowercase doctype #822

ngyikp opened this issue Jun 3, 2017 · 10 comments · Fixed by #944

Comments

@ngyikp
Copy link

ngyikp commented Jun 3, 2017

Currently, the useShortDoctype option rewrites doctypes to uppercase

HTML5 Boilerplate uses lowercase doctype for several years already, there's not much complaints other than incompatibility with XHTML

h5bp/html5-boilerplate#1522

@alexlamsl
Copy link
Collaborator

Does the current behaviour cause failure in any major browsers?

@ngyikp
Copy link
Author

ngyikp commented Jun 3, 2017

No

It's just a compression suggestion to shave a few bytes when gzipped

@alexlamsl
Copy link
Collaborator

Unless there is comprehensive proof that nothing breaks and there is a general reduction in gzip sizes across a representative sample, I'm reluctant for any code changes.

@XhmikosR
Copy link
Collaborator

XhmikosR commented Jul 7, 2018

@alexlamsl: you should revisit this. Lowecase doctype does save a few bytes and doesn't cause any issues.

@alexlamsl
Copy link
Collaborator

@XhmikosR I shall take your word on compatibility 😉

Will put together a PR after my belated 🎂 party.

@alexlamsl alexlamsl reopened this Jul 8, 2018
@XhmikosR
Copy link
Collaborator

XhmikosR commented Jul 8, 2018

Hey, it's no my word, it's the community's word ;) You can never beat such extended testing.

@alexlamsl
Copy link
Collaborator

Speaking of community...

https://stackoverflow.com/questions/7020961/uppercase-or-lowercase-doctype

Note that if you don’t uppercase DOCTYPE in an XHTML document, the XML parser will return a syntax error.

According to the discussions above, if we go for uppercase, everything works - otherwise something might break.

@XhmikosR
Copy link
Collaborator

XhmikosR commented Jul 8, 2018

But when the option to use the HTML5 doctype is enabled, then that case isn't valid, is it? Or maybe I'm missing something in regards to XHTML since I've never had the need to use such thing.

@DamonHD
Copy link

DamonHD commented Jul 8, 2018

FWIW I can confirm that in my use case, for minified static (GZIPPed) HTML pages, using "doctype" lowercase does save bytes in the compressed/transferred result. If I wanted XHTML output then all sorts of other optimisations would have to go away too, such as dropping optional closing tags and element* quoting.

[Edit: * I meant attribute value, sorry!]

@alexlamsl
Copy link
Collaborator

@XhmikosR they mentioned something along the lines of XHTML5

@DamonHD thanks for the observation and the point about optional tags

I was worried about those enterprisy (read: Java) libraries getting upset about conformance issues, but you guys have successfully convinced me otherwise.

Will put that PR together when I get home.

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

Successfully merging a pull request may close this issue.

4 participants