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

Martin Payne martin-bulkmail at martinpayne.co.uk
Mon Jun 18 14:23:11 PDT 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.

Not for me it doesn’t (Mozilla/5.0 (X11; U; Linux i686; en-US; 
rv:1.8.1.4) Gecko/20070603 Fedora/2.0.0.4-2.fc8 Firefox/2.0.0.4). Both 
render in standards mode for me.

-- 
Martin Payne

email: martin-bulkmail at martinpayne.co.uk
www: http://www.martinpayne.co.uk/



More information about the whatwg mailing list