NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 836 - Warning message for comments before DOCTYPE is inaccurate
Warning message for comments before DOCTYPE is inaccurate
Status: NEW
Product: Validator.nu
Classification: Unclassified
Component: HTML parser
HEAD
All All
: P2 normal
Assigned To: Nobody
data:text/html;charset=utf-8,%3C!--%5...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-19 18:41 CEST by Leif Halvard Silli
Modified: 2011-05-19 18:41 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leif Halvard Silli 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.