Bugzilla – Bug 836
Warning message for comments before DOCTYPE is inaccurate
Last modified: 2011-05-19 18:41:59 CEST
For the code ]] <!--[if ie]><![endif]--> <!DOCTYPE html> [[ Validator.nu now says: ]] Warning: Comments seen before doctype. Internet Explorer will go into the quirks mode. [[ As you probably know, that warning message is not 100% correct. FIRSTLY, the effect can be overruled via x-ua-compatible ... SECONDLY, if the comment also is a conditional comment, then it depends on whether the conditional comment targets IE THIRDLY, when a conditional comment targets IE, then it depends the content of the conditional comment: * If content starts with a valid DOCTYPE, then nothing special happens * If content is a <meta> element, then IE moves it into <head>, where it is treated as if it was there the entire time, (which in turn may affect the mode e.g. if it is an x-ua-compatible <meta> element) * Most (or any?) other elements inside bring IE in quirks-mode * Any non-element content inside bring IE in quirks-mode A rephrasing proposal: "Warning: Comments seen before doctype. There is a high risk that Internet Explorer will go into quirks-mode." Eventually, the warning message could recommend authors to use conditioanl commments that do not target IE.