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:
- Almost all existing
text/htmlpages 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.) - Authors writing Web pages to current standards should be able to trigger strict mode.
- Pages written using any public identifiers in DOCTYPE declarations that appear in the future should be displayed using strict mode.
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.
