Because existing content on the web is not standards-compliant or would appear in unintended ways on a standards-compliant browser, Mozilla handles some content in a backwards compatible way and some content according to standards.
There are three modes used by the layout engine: quirks mode, almost standards mode, and full standards mode. In Quirks mode, layout emulates nonstandard behavior in Navigator 4 and MSIE for Windows that is required not to break existing content on the Web. In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS specifications. In almost standards mode, there are only a very small number of quirks implemented: those that break real pages on the web that use the DOCTYPEs that trigger almost standards mode.
How does Mozilla determine which mode to use?
For documents sent as text/html, Mozilla must decide whether to handle them in quirks mode or standards mode. (Content sent as text/xml or other XML or XHTML MIME types is always handled in strict mode.) Currently Mozilla does this through DOCTYPE sniffing. That is, it uses the DOCTYPE declaration (DTD) as a hint as to whether the page is a recently written web page that can be expected to behave properly when all standard behavior is used. See the detailed description of how DOCTYPE sniffing is used to determine the layout mode.
There have been requests for authors to be able to set (or suggest) the layout mode without changing the DTD of the page, since the DTD exists primarily for other reasons. So far no such method has been implemented, but the leading proposal is an HTTP header that would also be accessible through a META element in the head of the document.
What are the differences between the modes?
See the list of quirks for the differences between the modes.
Original Document Information
- Author(s): David Baron
- Last Updated Date: December 12, 2004