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

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