How do I get the "HTML 4.01 Strict" doctype in Express/Jade?


I'm migrating old sites to Express/Jade having the "HTML 4.01 Strict" doctype. I want to keep this doctype for now.

How do I get this doctype in Express/Jade?

"doctype strict" only provides the XML type, not HTML.

Of course I can type the doctype manually, but this doesn't work because Jade will insert an extra "/" at the end of each HTML element in the rest of the document (as if the document was XML), which leads to validation errors.

Problem courtesy of: lwood


doctype strict

Will give you:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

I believe that is the closest you could get.

P.S.: If you're migrating, why not change, since you have to touch it anyway?

Solution courtesy of: TheHippo


Doctype only get IE out of quirks mode. Otherwise, they are basically ignored by browsers. Only a xhtml doctype is different as it could be parsed as XML with different parser. But from the browser stand point, as long as you have a doctype (no mather which one), it'll work.

Although, in Jade, you can:

# doctype <anything>
doctype HTML 4.01 Strict
Discussion courtesy of: Simon Boudrias

This recipe can be found in it's original form on Stack Over Flow.