W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > February 2011

[Bug 12072] Comments before <!DOCTYPE html> should be forbidden

From: <bugzilla@jessica.w3.org>
Date: Thu, 17 Feb 2011 17:46:07 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1Pq7vb-0007Ko-4p@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=12072

--- Comment #17 from Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no> 2011-02-17 17:46:06 UTC ---
As a secondary argument, one can also look at how Microsoft's proprietary
conditional comments and x-ua-compatible directive (which also Google Chrome
uses) are affected by comments before the DOCTYPE.  And one will then find
that:

 * conditional comments before DOCTYPE messes up  IE's version vector system
 * x-ua-compatible can break when there is a comment before DOCTYPE

Example 1: "normal" use of x-ua-compatible

<!DOCTYPE html><html><head>
<meta content="IE=7" http-equiv="x-ua-compatible"
/><title></title></head><body>
<![if ie 7]>IE7<![endif]><![if ie 8]>IE8<![endif]><![if ie
9]>IE9<![endif]></body></html>

In above document,  the  X-UA-COMPATIBLE meta element is, as expected, inside
the head element. Thus version vectors work as designed by Microsoft: both IE8
and IE9 will report that they are IE7.


Example 2: messed up by conditioanl comments.

<!--[if gt IE 7]><meta content="IE=7" http-equiv="x-ua-compatible"
/><![endif]-->
<!DOCTYPE html><html><head><title></title></head><body>
<![if ie 7]>IE7<![endif]><![if ie 8]>IE8<![endif]><![if ie
9]>IE9<![endif]></html>

In above document, IE8 and IE9 will change to IE7 modus. But despite changing
modus, IE8 will identify tiself as IE8 and  IE9 will identify itself as IE9. 
(This has something to do with the fact that the META element is moved inside
the head element  in the DOM.)


Example 3: x-ua-compatible breaks because of comment

<!---->
<!DOCTYPE html><html><head>
<meta content="IE=EmulateIE7" http-equiv="x-ua-compatible"
/><title></title></head><body>
<![if ie 7]>IE7<![endif]><![if ie 8]>IE8<![endif]><![if ie
9]>IE9<![endif]></html>

The values 'EmulateIE7', 'EmulateIE8' and 'EmulateIE9' will tell, according to
Microsoft, "Internet Explorer to use the <!DOCTYPE> directive to determine how
to render content".  Thus, authors should therefore expect that the above
document would render in standards mode, due to the fact that it uses a
standards triggering DOCTYPE.  However, because of that comment before the
DOCTYPE, the X-UA-COMPATIBLE directive actually fails to live up to its
expectation. And the author furhter more gets confused.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Thursday, 17 February 2011 17:46:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 17 February 2011 17:46:36 GMT