W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2007

[whatwg] HTML syntax: comments before doctype and doctype sniffing

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 18 Jun 2007 21:40:30 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.0706182137490.8482@dhalsim.dreamhost.com>
On Mon, 18 Jun 2007, Philip Taylor wrote:
> 
> In Firefox 2:
> 
> javascript:s='<?>';for(i=0;i<1006;++i)s+='
> ';window.location='data:text/html,'+s+'<!doctype
> html><script>document.write(document.compatMode)</script>'
> 
> javascript:s='<?>';for(i=0;i<1007;++i)s+='
> ';window.location='data:text/html,'+s+'<!doctype
> html><script>document.write(document.compatMode)</script>'
> 
> The first produces CSS1Compat, the second BackCompat. As far as I can 
> tell, Firefox requires the doctype to be found when parsing [using 
> standards-mode rules] the first 1024 characters (not bytes) from the 
> first non-whitespace character, and then it reparses the whole document 
> in quirks mode if necessary.

Hm, indeed, how odd. (It doesn't happen if you have purely spaces there, 
you need some sort of content there first.) Still, I don't think we should 
try to duplicate this unless we have evidence that it really is needed, as 
I described in my previous e-mail.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 18 June 2007 14:40:30 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:56 UTC