Quirk/Compat vs. Strict

These are some of my (Tantek Çelik's) notes regarding my implementation of doctype base quirky/strict rendering switching in Internet Explorer 5.0 for the Macintosh. These are merely notes and are not normative by any means. I'm working on writing up a coherent article on this subject which will hopefully serve as something more solid to refer to.

DocType switching

Written 1999.08.19

The HTML4 Transitional DTD (specifically without a URL) causes MacIE5 to interpret the document as quirky (or backwards-compatible.

Using the HTML4 Strict DTD will disable quirky handling such as the TABLE default style sheet rule mentioned above.

You can choose "strict" mode by using the HTML 4.0/Transitional DTD WITH a URL, just like the W3C CSS1 Test Suite does.

http://www.w3.org/Style/CSS/Test/

For authors, we strongly recommend authoring to standards, and for that they can use the HTML 4 Strict DTD, HTML 4 Transitional DTD (with URL), or XML.

Written 2000.01.17

IF you want strictly standards compliant behavior, then you must do TWO things:

  1. Use a strict DTD in your document.
  2. Make sure your document validates using the W3C validator
    http://validator.w3.org/

IF you want quirky behavior, but still want to validate your document as HTML4, use the HTML4 transitional DTD (and don't use a URL in it. if you use a URL with transitional, we consider it strict).

IF you want quirky behavior and don't want to deal with getting your documents to validate, then USE NO DTD.

The worst thing you could in regards to quirky/strict handling of your documents would be to slap an HTML 4 DTD on it, and then not bother validating the document. I don't want to mention any names, but the home page of a certain corporation uses:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

on a document that doesn't validate. Very annoying. If you have any control over this sort of thing, please don't do this.

Written 2000.03.20

XML documents are strict by default.

All XML documents are treated as strict. With or without DTD.

XML documents are typically identified by the fact that they start with the XML declaration:

<?xml version="1.0"?>

Typically just the <?xml portion alone should be enough to make MacIE5 think it is getting XML, and treat it as such.

HTML documents are quirky by default.

For an HTML document to be treated as strict, it needs a DTD.

Note that the following conditions cause an HTML document to be treated as quirky:

Alternatively, note that the following conditions cause an HTML document to be treated as strict:

*Note that any other DTD that is not " HTML", in addition to being treated strict, is flagged as non-HTML. MacIE5 currently doesn't really do anything with that information, but may at some future point (such as ignore HTML specific attributes).

Written 2000.03.30

HTML4: for Quirky/Compat use Transitional w/o URL, for Strict use Strict w/ URL

for forward compatibility reasons, I would rather not see authors depending on the HTML4 Transitional + URL acting as strict - I can see the day where we treat all Transitional Doctypes as QUIRKY/COMPAT. the current handling of HTML4 Transitional + URL may be ephemeral.

Written 2000.04.17

Strict custom DOCTYPEs. Use " HTML" or " html" as substring w/o 2,3,4, but with URL

Some Web developers need to use custom HTML DOCTYPEs and want strict rendering. I recommend those web authors do the following:

  1. Use a DOCTYPE with " HTML" or " html" inside it.
  2. Don't use a version # of HTML that the W3C has published, e.g. " HTML 2" or " HTML 4" or " HTML plus" or " HTML EXPERIMENTAL" or "W3 HTML"
  3. Don't use a DOCTYPE that is used in bookmark files of some legacy UAs (e.g. "DOCTYPE NETSCAPE".

If the custom DOCTYPE does not want HTML semantics implied, then don't use " HTML" or " html" within the DOCTYPE. Note: some HTML semantics may be applied anyway, but if you're coding outside of HTML you're coding for the future anyway right?

There is currently no recommended solution for using a custom HTML DOCTYPE and getting compat/quirky rendering. This was not seen as important enough to support moving forward. The theory is that if you are eccentric enough to use a custom HTML DOCTYPE in the first place, you would have no problems with only being guaranteed strict treatment.

Quirk/Compat differences

Written 1999.08.19

Now, one of the things that backward compatible browsers do is have an implicit default style sheet rule like this (not real CSS, but you get the idea):

TABLE { font: medium normal serif; color: attr(BODY,COLOR); }

The rules and handling we have in place for "quirky" documents are not for the sake of authors. The quirky behaviors are there for the sake of users, so that pages that were authored in the past depending on these quirks will still render as correctly as can be, and closer to what their authors intended.

The "quirky" rules are not random - they are added for backwards compat with WinIE5 and other popular browsers. And they are very carefully added, and we are deliberately not going to document them all - authors should not be depending on quirky behavior moving forward.

Now, if you actually find an inconsistency in the quirkiness handling between MacIE5 and WinIE5, then please point those out - those need to (probably) be fixed.

Written 2000.01.24

One emulated quirk along that path is the default (non)-inheritance of font properties into TABLE tags.

Emulated quirks originated from one or more (perhaps independently) of the following:

Written 2000.02.25

ALWAYS (from HTML)
 - Unstyled text is equivalent to HTML FONT SIZE=3

STRICT:
 - CSS 'medium' is same as unstyled text per CSS-1.
 - hence 'font-size:medium' is the same as <FONT SIZE=3>

QUIRKY/COMPAT:
 - the seven CSS font-size keywords are mapped 1:1 to the seven HTML FONT SIZE
values, xx-small..xx-large = 1..7
 - hence 'font-size:small' is the same as <FONT SIZE=3>