Hacker News new | ask | show | jobs
by 98469056 651 days ago
While peeking at the source, I noticed that the doctype declaration is missing a space. It currently reads <!doctypehtml>, but it should be <!doctype html>
3 comments

`<!doctype html>` can be minified into `<!doctypehtml>`.

It’s, strictly speaking, invalid HTML, but it still successfully triggers standards mode.

See https://GitHub.com/kangax/html-minifier/pull/970 / https://HTML.spec.WHATWG.org/multipage/parsing.html#parse-er...

(I too use that trick on https://FreeSolitaire.win)

Why would you do this?
To have FreeSolitaire.win homepage be only 20.7 kB over the wire.

That’s for the whole game: graphics are inline SVGs, JS & CSS are embedded in <script> and <style> elements.

To be clear, you can minimize much further than what you already have. For example you haven't fully minified SVG, which can be also replaced with just symbol characters. Saving a single space from `<!doctype html>` is insignificant compared to that.
This would be another interesting story about web optimization if you wrote a post about it! :)
Right but surely skipping that space wasn't that much of a win
Sounds like this is from a minifier that removes as much as it can [0]

0: https://github.com/KTibow/KTibow/issues/3#issuecomment-23367...

Maybe their javascript adds it back in :)