¸ðÁú¶ó ¹®¼Çü½Ä(DOCTYPE) ¾Ë¾Æ³»±â
Mozilla's DOCTYPE sniffing
ÀÌ ¹®¼´Â ¸ðÁú¶ó°¡ ¾ö°Ý¸ðµå Óß ÄíÅ©¸ðµå¸¦ °áÁ¤Çϱâ À§ÇØ ¹®¼Çü½Ä(DOCTYPE)¼±¾ðÀ» »ç¿ëÇÏ´Â ¹æ½Ä¿¡ ´ëÇØ ¼³¸íÇÕ´Ï´Ù. ÀÌ·¯ÇÑ °áÁ¤À» ÇÏ´Â ÄÚµå´Â ÇöÀç DetermineParseMode() in nsParser.cpp¿¡ ÀÖ½À´Ï´Ù. ¹æ½Ä°áÁ¤ÀÇ ¿ª»ç¸¦ ã°íÀÖ´Ù¸é ¹ö±× 1312¿Í ¹ö±× 55264¸¦ Âü°íÇϼ¼¿ä. ¸ðÁú¶ó 1.0´ëÀÇ ÁØÇ¥Áعæ½ÄÀÌ ¸¸µé¾îÁø ÀÌÀ¯¿¡ ´ëÇØ¼´Â ¹ö±× 153032¸¦ Âü°íÇϼ¼¿ä. ÀÌ·± 󸮹æ½ÄÀ» ¼±ÅÃÇÏ°Ô µÈ ¸ñÀûÀº ´ÙÀ½ÀÇ ÀÌÀ¯¿´½À´Ï´Ù:
This document contains 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 ÆäÀÌÁö´Â ÄõÅ©¹æ½ÄÀ» »ç¿ëÇÏ¿© Ç¥½ÃµÇ¾î¾ß ÇÑ´Ù. (¸ðµÎ´Â ¾Æ´Ï´õ¶óµµ °ÅÀÇ ¸ðµç ÆäÀÌÁö´Â ´ÙÀ½ ³»¿ëÀ» ¸¶Âù°¡Áö·Î Çã¿ëÇÑ´Ù)
- ÇöÀçÀÇ Ç¥ÁØÀ» µû¸£´Â À¥ÆäÀÌÁö Á¦ÀÛÀÚ´Â ¾ö°Ý¸ðµå¸¦ »ç¿ëÇÒ ¼ö ÀÖ¾î¾ß ÇÑ´Ù.
- ¹®¼Çü½Ä(DOCTYPE) ¼±¾ð¿¡¼ ¾î¶² °ø°³ ÀνÄÀÚ(public identifier)¸¦ »ç¿ëÇÑ ÆäÀÌÁö´Â ¾ö°Ý¸ðµå¸¦ »ç¿ëÇÏ¿© Ç¥½ÃµÇ¾î¾ß ÇÑ´Ù.
- 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.
Àü(îï)Ç¥Áعæ½Ä
Full Standards Mode
´ÙÀ½Àº ÀüÇ¥Áعæ½ÄÀ¸·Î ó¸®ÇÕ´Ï´Ù:
The following trigger full standards mode:
text/xml,application/xml, ¶Ç´Âapplication/xhtml+xml°ú °°Àº XML MIME Çü½ÄÀ¸·Î Àü¼ÛµÈ ¹®¼ (¾Ë¾Æ³»´Â °ÍÀº text/html·Î Àü¼ÛµÈ ¹®¼¿¡ ´ëÇØ¼¸¸ ¹ß»ýÇϱ⠶§¹®ÀÔ´Ï´Ù)- ¾Æ·¡¿¡ ¼³¸íÇϰí ÀÖ´Â IBM ¹®¼Çü½ÄÀ» Á¦¿ÜÇϰí, "DOCTYPE HTML PUBLIC"¿¡ ¹Ý´ëµÇ´Â °ÍÀ¸·Î½á "DOCTYPE HTML SYSTEM"·Î µÈ °ÍÀº ¹«¾ùÀ̵ç.
- DTD¾øÀÌ DOCTYPEÀ» ¼±¾ðÇÑ °æ¿ì. ¿¹¸¦ µé¾î
<!DOCTYPE HTML> - ³»ºÎ ÇÏÀ§¹À½(subsect)À¸·Î DOCTYPEÀ» ¼±¾ðÇÑ °æ¿ì
- °ü·Ã ±â¼úºÐ¾ß¿¡¼´Â ¾Ë·ÁÁ®ÀÖ´Â ´ÙÀ½ÀÇ ¹®¼Çü½Ä:
- °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.01//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.0//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD XHTML 1.0 Strict//EN". - °ø°³ ÀνÄÀÚ
"ISO/IEC 15445:1999//DTD HyperText Markup Language//EN". - °ø°³ ÀνÄÀÚ
"ISO/IEC 15445:1999//DTD HTML//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML i18n//EN".
- °ø°³ ÀνÄÀÚ
¡¡
- Any document sent with an XML MIME type such as
text/xml,application/xml, orapplication/xhtml+xml(since sniffing only occurs for documents sent astext/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:
- °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.01//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.0//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD XHTML 1.0 Strict//EN". - °ø°³ ÀνÄÀÚ
"ISO/IEC 15445:1999//DTD HyperText Markup Language//EN". - °ø°³ ÀνÄÀÚ
"ISO/IEC 15445:1999//DTD HTML//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML i18n//EN".
- °ø°³ ÀνÄÀÚ
ÁØ(ñÞ)Ç¥Áعæ½Ä
Almost Standards Mode
´ÙÀ½Àº ÁØÇ¥Áعæ½ÄÀ¸·Î 󸮵˴ϴÙ. ÁØÇ¥Áعæ½ÄÀº 1.0°ú 1.1¾ËÆÄ ÀÌÈÄ, ±×·¯³ª 1.0.1°ú 1.1º£ÆÄ¿¡ ¸¸µé¾îÁ³½À´Ï´Ù. ÁØÇ¥Áعæ½ÄÀÌ ¸¸µé¾îÁö±â Àü¿¡ ÀÌµé ¹®¼Çü½ÄÀº Àü(îï)Ç¥Áعæ½ÄÀ¸·Î 󸮵Ǿú½À´Ï´Ù.
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.
- °ø°³ ÀνÄÀÚ
"-//W3C//DTD XHTML 1.0 Transitional//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD XHTML 1.0 Frameset//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.01 Transitional//EN", with a system 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):
´ÙÀ½ »çÀÌÆ®´Â ÀÌ ¸ñ·ÏÀ» ÁغñÇÏ´Â µ¥ À¯¿ëÇß´ø °÷ÀÔ´Ï´Ù: W3C HTML Validator, HTMLHelp HTML Validator.
The following sites have been useful in preparing this list: W3C HTML Validator, HTMLHelp HTML Validator.
- DOCTYPEÀÌ ¾ø´Â °æ¿ì
- ¹®¼Çü½ÄÀÌ ¾øÀÌ XMLÀ» ¼±¾ðÇÑ °æ¿ì (pseudo-PI) (´Þ¸® ¸»Çϸé, XML ¼±¾ðÀ» ¹«½ÃÇϰí DOCTYPEÀ» »ç¿ëÇÕ´Ï´Ù). 1.1°ú 1.1 ¾ËÆÄ ÀÌÀü(±×·¯³ª 1.0.1 ¶Ç´Â 1.1 º£Å¸¿¡¼´Â ¾Æ´Ñ) ¹öÀü¿¡¼, XML ¼±¾ðÀ» Çϸé Àü(îï)Ç¥Áعæ½ÄÀ¸·Î ó¸®ÇÕ´Ï´Ù.
- ½Ã½ºÅÛ ÀνÄÀÚ "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" °¡ ÀÖ´Â °æ¿ì (1.5b¿Í 1.4.2 ÀÌÀü¿¡, ÀÌ·± °æ¿ì ÁØÇ¥Áعæ½ÄÀ¸·Î ó¸®ÇÏ¿´½À´Ï´Ù.)
¡¡
- 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 "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" (before 1.5b and 1.4.2, this triggered almost standards mode).
- °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.01 Transitional//EN", ½Ã½ºÅÛÀνÄÀÚ(system identifier) ¾øÀÌ - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.01 Frameset//EN", ½Ã½ºÅÛÀνÄÀÚ( system identifier) ¾øÀÌ - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.0 Transitional//EN"(½Ã½ºÅÛÀνÄÀÚ°¡ ÀÖ´Â °æ¿ìÀÇ ¸ð½ÀÀ» º¸¼¼¿ä). - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 4.0 Frameset//EN"(½Ã½ºÅÛÀνÄÀÚ°¡ ÀÖ´Â °æ¿ìÀÇ ¸ð½ÀÀ» º¸¼¼¿ä). - °ø°³ ÀνÄÀÚ
"-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//EN". - °ø°³ ÀνÄÀÚ
"-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML//EN//3.0". - °ø°³ ÀνÄÀÚ
"-//W3O//DTD W3 HTML 3.0//EN//". - °ø°³ ÀνÄÀÚ
"-//W3O//DTD W3 HTML 3.0//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 3 1995-03-24//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 3.0//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 3.0//EN//". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 3//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 3//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 3//EN//3.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 3.2//EN". - °ø°³ ÀνÄÀÚ
"-//AS//DTD HTML 3.0 asWedit + extensions//EN". - °ø°³ ÀνÄÀÚ
"-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict//EN//3.0". - °ø°³ ÀνÄÀÚ
"-//W3O//DTD W3 HTML Strict 3.0//EN//". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 3//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 3//EN//3.0". - °ø°³ ÀνÄÀÚ
"HTML". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 2.0//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 2//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 2//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 2.0 Level 2//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 1//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 1//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 2.0 Level 1//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 0//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Level 0//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 2//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 2//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 2.0 Strict//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 2.0 Strict Level 2//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 1//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 1//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 2.0 Strict Level 1//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 0//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML Strict Level 0//EN//2.0". - °ø°³ ÀνÄÀÚ
"-//WebTechs//DTD Mozilla HTML//EN". - °ø°³ ÀνÄÀÚ
"-//WebTechs//DTD Mozilla HTML 2.0//EN". - °ø°³ ÀνÄÀÚ
"-//Netscape Comm. Corp.//DTD HTML//EN". - °ø°³ ÀνÄÀÚ
"-//Netscape Comm. Corp.//DTD HTML//EN". - °ø°³ ÀνÄÀÚ
"-//Netscape Comm. Corp.//DTD Strict HTML//EN". - °ø°³ ÀνÄÀÚ
"-//Microsoft//DTD Internet Explorer 2.0 HTML//EN". - °ø°³ ÀνÄÀÚ
"-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//EN". - °ø°³ ÀνÄÀÚ
"-//Microsoft//DTD Internet Explorer 2.0 Tables//EN". - °ø°³ ÀνÄÀÚ
"-//Microsoft//DTD Internet Explorer 3.0 HTML//EN". - °ø°³ ÀνÄÀÚ
"-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//EN". - °ø°³ ÀνÄÀÚ
"-//Microsoft//DTD Internet Explorer 3.0 Tables//EN". - °ø°³ ÀνÄÀÚ
"-//Sun Microsystems Corp.//DTD HotJava HTML//EN". - °ø°³ ÀνÄÀÚ
"-//Sun Microsystems Corp.//DTD HotJava Strict HTML//EN". - °ø°³ ÀνÄÀÚ
"-//IETF//DTD HTML 2.1E//EN". - °ø°³ ÀνÄÀÚ
"-//O'Reilly and Associates//DTD HTML Extended 1.0//EN". - °ø°³ ÀνÄÀÚ
"-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//EN". - °ø°³ ÀνÄÀÚ
"-//O'Reilly and Associates//DTD HTML 2.0//EN". - °ø°³ ÀνÄÀÚ
"-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN". - °ø°³ ÀνÄÀÚ
"-//Spyglass//DTD HTML 2.0 Extended//EN". - °ø°³ ÀνÄÀÚ
"+//Silmaril//DTD HTML Pro v0r11 19970101//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML Experimental 19960712//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 3.2//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 3.2 Final//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 3.2 Draft//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML Experimental 970421//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD HTML 3.2S Draft//EN". - °ø°³ ÀνÄÀÚ
"-//W3C//DTD W3 HTML//EN". - °ø°³ ÀνÄÀÚ
"-//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.)
