¸ðÁú¶ó ¹®¼­Çü½Ä(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/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:

¡¡

ÁØ(ñÞ)Ç¥Áعæ½Ä

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.

ÄõÅ©¹æ½Ä

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.

¡¡

°ø°³ ÀνÄÀÚ¸¦ ÀûÀýÇÏÁö ¾ÊÀº °æ¿ì¿¡ »ç¿ëÇÏ´Â ¼ö¸¹Àº ÆäÀÌÁö ¶§¹®¿¡ ¸ðµç °ø°³ ÀνÄÀÚ¿¡ º¸ÀÌ´Â À¯»ç¼ºÀº ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐÇÏÁö ¾Ê´Â´Ù´Â Á¡¿¡ À¯ÀÇÇϽñ⠹ٶø´Ï´Ù. (À̰ÍÀº ±â¼úÀûÀ¸·Î ¿Ã¹Ù¸¥ °ÍÀº ¾Æ´ÏÁö¸¸, ¹®ÀÚ¿­Àº ´ë¼Ò¹®ÀÚ¸¦ ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐÇÕ´Ï´Ù)

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.)