There are 2048 doctypes

doctypes
Tags: #<Tag:0x00007f21b23f5c48>

#1

Okay, consider:

In HTML, the doctype is the required " <!DOCTYPE html> " preamble found at the top of all documents. Its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the " <!DOCTYPE html> " doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications.

Here’s the cool thing about doctype:

https://html.spec.whatwg.org/multipage/syntax.html#the-doctype

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 ASCII whitespace.
  3. A string that is an ASCII case-insensitive match for the string " html ".
  4. Optionally, a DOCTYPE legacy string.
  5. Zero or more ASCII whitespace.
  6. A U+003E GREATER-THAN SIGN character (>).

In other words, <!DOCTYPE html> , case-insensitively.

So that means you can use any case for D O C T Y P E H T M or L. I wanted to see how many there were, and remembered a funny echo line:

echo {d,D}{o,O}{c,C}{t,T}{y,Y}{p,P}{e,E}\ {h,H}{t,T}{m,M}{l,L}

I couldn’t figure out a way to line break those, so I exported to a text file and did a replace. And here it is, from <!doctype html> to <!dOCTYPE HTML>. :slight_smile:

doctype.txt (32 KB)