Os nossos voluntários ainda não traduziram este artigo para Português (Europeu) . Junte-se a nós e ajude-nos a fazer o trabalho!
Obsolete since Gecko 2 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
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/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.) - 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.
Full Standards Mode
The following trigger full standards mode:
- Any document sent with an XML MIME type such as
text/xml
,application/xml
, orapplication/xhtml+xml
(since sniffing only occurs for documents sent as text/html). - Any "DOCTYPE HTML SYSTEM" as opposed to "DOCTYPE HTML PUBLIC", except for the IBM doctype noted below
- A DOCTYPE declaration without a DTD, i.e., <!DOCTYPE HTML>.
- A DOCTYPE declaration with an internal subset.
- Any unknown doctype, which should include the following (technically known) doctypes:
- The public identifier "-//W3C//DTD HTML 4.01//EN".
- The public identifier "-//W3C//DTD HTML 4.0//EN".
- The public identifier "-//W3C//DTD XHTML 1.0 Strict//EN".
- The public identifier "ISO/IEC 15445:2000//DTD HyperText Markup Language//EN".
- The public identifier "ISO/IEC 15445:2000//DTD HTML//EN".
- The public identifier "-//IETF//DTD HTML i18n//EN".
Almost Standards Mode
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 public identifier "-//W3C//DTD XHTML 1.0 Transitional//EN".
- The public identifier "-//W3C//DTD XHTML 1.0 Frameset//EN".
- The public identifier "-//W3C//DTD HTML 4.01 Transitional//EN", with a system identifier.
- The public identifier "-//W3C//DTD HTML 4.01 Frameset//EN", with a system identifier.
Quirks 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.
- The absence of a DOCTYPE.
- An XML declaration (pseudo-PI) without a doctype (in other words, ignore the XML declaration and use the DOCTYPE). In 1.0 and 1.1alpha and earlier (but not in 1.0.1 or 1.1beta), the presence of an XML declaration triggered full standards mode.
- A DOCTYPE declaration that cannot be understood (e.g., no matching quote).
- The system identifier "https://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" (before 1.5b and 1.4.2, this triggered almost standards mode).
- The public identifier "-//W3C//DTD HTML 4.01 Transitional//EN", without a system identifier.
- The public identifier "-//W3C//DTD HTML 4.01 Frameset//EN", without a system identifier.
- The public identifier "-//W3C//DTD HTML 4.0 Transitional//EN" (see also test with a system identifier).
- The public identifier "-//W3C//DTD HTML 4.0 Frameset//EN" (see also test with a system identifier).
- The public identifier "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//EN".
- The public identifier "-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//EN".
- The public identifier "-//IETF//DTD HTML//EN//3.0".
- The public identifier "-//W3O//DTD W3 HTML 3.0//EN//".
- The public identifier "-//W3O//DTD W3 HTML 3.0//EN".
- The public identifier "-//W3C//DTD HTML 3 1995-03-24//EN".
- The public identifier "-//IETF//DTD HTML 3.0//EN".
- The public identifier "-//IETF//DTD HTML 3.0//EN//".
- The public identifier "-//IETF//DTD HTML 3//EN".
- The public identifier "-//IETF//DTD HTML Level 3//EN".
- The public identifier "-//IETF//DTD HTML Level 3//EN//3.0".
- The public identifier "-//IETF//DTD HTML 3.2//EN".
- The public identifier "-//AS//DTD HTML 3.0 asWedit + extensions//EN".
- The public identifier "-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//EN".
- The public identifier "-//IETF//DTD HTML Strict//EN//3.0".
- The public identifier "-//W3O//DTD W3 HTML Strict 3.0//EN//".
- The public identifier "-//IETF//DTD HTML Strict Level 3//EN".
- The public identifier "-//IETF//DTD HTML Strict Level 3//EN//3.0".
- The public identifier "HTML".
- The public identifier "-//IETF//DTD HTML//EN".
- The public identifier "-//IETF//DTD HTML//EN//2.0".
- The public identifier "-//IETF//DTD HTML 2.0//EN".
- The public identifier "-//IETF//DTD HTML Level 2//EN".
- The public identifier "-//IETF//DTD HTML Level 2//EN//2.0".
- The public identifier "-//IETF//DTD HTML 2.0 Level 2//EN".
- The public identifier "-//IETF//DTD HTML Level 1//EN".
- The public identifier "-//IETF//DTD HTML Level 1//EN//2.0".
- The public identifier "-//IETF//DTD HTML 2.0 Level 1//EN".
- The public identifier "-//IETF//DTD HTML Level 0//EN".
- The public identifier "-//IETF//DTD HTML Level 0//EN//2.0".
- The public identifier "-//IETF//DTD HTML Strict//EN".
- The public identifier "-//IETF//DTD HTML Strict//EN//2.0".
- The public identifier "-//IETF//DTD HTML Strict Level 2//EN".
- The public identifier "-//IETF//DTD HTML Strict Level 2//EN//2.0".
- The public identifier "-//IETF//DTD HTML 2.0 Strict//EN".
- The public identifier "-//IETF//DTD HTML 2.0 Strict Level 2//EN".
- The public identifier "-//IETF//DTD HTML Strict Level 1//EN".
- The public identifier "-//IETF//DTD HTML Strict Level 1//EN//2.0".
- The public identifier "-//IETF//DTD HTML 2.0 Strict Level 1//EN".
- The public identifier "-//IETF//DTD HTML Strict Level 0//EN".
- The public identifier "-//IETF//DTD HTML Strict Level 0//EN//2.0".
- The public identifier "-//WebTechs//DTD Mozilla HTML//EN".
- The public identifier "-//WebTechs//DTD Mozilla HTML 2.0//EN".
- The public identifier "-//Netscape Comm. Corp.//DTD HTML//EN".
- The public identifier "-//Netscape Comm. Corp.//DTD HTML//EN".
- The public identifier "-//Netscape Comm. Corp.//DTD Strict HTML//EN".
- The public identifier "-//Microsoft//DTD Internet Explorer 2.0 HTML//EN".
- The public identifier "-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//EN".
- The public identifier "-//Microsoft//DTD Internet Explorer 2.0 Tables//EN".
- The public identifier "-//Microsoft//DTD Internet Explorer 3.0 HTML//EN".
- The public identifier "-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//EN".
- The public identifier "-//Microsoft//DTD Internet Explorer 3.0 Tables//EN".
- The public identifier "-//Sun Microsystems Corp.//DTD HotJava HTML//EN".
- The public identifier "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//EN".
- The public identifier "-//IETF//DTD HTML 2.1E//EN".
- The public identifier "-//O'Reilly and Associates//DTD HTML Extended 1.0//EN".
- The public identifier "-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//EN".
- The public identifier "-//O'Reilly and Associates//DTD HTML 2.0//EN".
- The public identifier "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN".
- The public identifier "-//Spyglass//DTD HTML 2.0 Extended//EN".
- The public identifier "+//Silmaril//DTD HTML Pro v0r11 19970101//EN".
- The public identifier "-//W3C//DTD HTML Experimental 19960712//EN".
- The public identifier "-//W3C//DTD HTML 3.2//EN".
- The public identifier "-//W3C//DTD HTML 3.2 Final//EN".
- The public identifier "-//W3C//DTD HTML 3.2 Draft//EN".
- The public identifier "-//W3C//DTD HTML Experimental 970421//EN".
- The public identifier "-//W3C//DTD HTML 3.2S Draft//EN".
- The public identifier "-//W3C//DTD W3 HTML//EN".
- The public identifier "-//Metrius//DTD Metrius Presentational//EN".
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.)
See Also
Original Document Information
- Author(s): David Baron
- Last Updated Date: August 2, 2005
- Copyright Information: Copyright (C) David Baron