Skip to content

Use lowercase doctype #822

Closed
Closed

Description

@ngyikp

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

Activity

  1. alexlamsl commented on Jun 3, 2017

    @alexlamsl
    Collaborator

    Does the current behaviour cause failure in any major browsers?

  2. ngyikp commented on Jun 3, 2017

    @ngyikp
    Author

    No

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

  3. alexlamsl commented on Jun 3, 2017

    @alexlamsl
    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.

  4. XhmikosR commented on Jul 7, 2018

    @XhmikosR
    Collaborator

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

  5. alexlamsl commented on Jul 8, 2018

    @alexlamsl
    Collaborator

    @XhmikosR I shall take your word on compatibility 😉

    Will put together a PR after my belated 🎂 party.

  6. XhmikosR commented on Jul 8, 2018

    @XhmikosR
    Collaborator

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

  7. alexlamsl commented on Jul 8, 2018

    @alexlamsl
    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.

  8. XhmikosR commented on Jul 8, 2018

    @XhmikosR
    Collaborator

    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.

  9. DamonHD commented on Jul 8, 2018

    @DamonHD

    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!]

  10. alexlamsl commented on Jul 8, 2018

    @alexlamsl
    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.

  11. added a commit that references this issue on Jul 8, 2018
    6740972
  12. added a commit that references this issue on Jul 8, 2018
    57bebd5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions