This document describes how Mozilla uses the DOCTYPE declaration to determine strict mode vs. quirks mode. The code that makes this determination is currently in DetermineParseMode() in nsParser.cpp . See bug 1312 and bug 55264 for some of the history of the mode determination. See bug 153032 for the creation of the Almost-Standards mode around Mozilla 1.0. The goals that led to choosing this behavior were the following:
text/html pages on the Web that need to be in quirks mode to be displayed correctly should be displayed using quirks mode. (Almost all, rather than all, to allow for the following points as well.)
In other words, the algorithm is the best approximation we can find for determining which pages were written after Mozilla became a known important user-agent on the Web.
The following trigger full standards mode:
text/xml, application/xml, or application/xhtml+xml (since sniffing only occurs for documents sent as text/html).
The following trigger almost standards mode. Almost standards mode was created after 1.0 and 1.1alpha, but before 1.0.1 and 1.1beta. Before almost standards mode was created these doctypes triggered full standards mode.
The following trigger quirks mode (this list needs to be comprehensive to ensure that pages already existing on the Web trigger quirks mode):
The following sites have been useful in preparing this list: W3C HTML Validator, HTMLHelp HTML Validator.
Note that all public identifier comparisons are case-insensitive due to the significant number of pages that use public identifiers with incorrect case. (This is technically incorrect, since the strings are case sensitive.)
Page last modified 15:05, 16 Mar 2008 by Kennykaiyinyu?