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

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

From: Philip Taylor <excors+whatwg@gmail.com>
Date: Mon, 18 Jun 2007 22:42:46 +0100
Message-ID: <ea09c0d10706181442r5dd03167q74e23b1a17702692@mail.gmail.com>
On 18/06/07, Martin Payne <martin-bulkmail at martinpayne.co.uk> wrote:
> 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.
>
> 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.

Hmm, that might have been some unfortunate line wrapping - it's
probably better to write:

javascript:s='<?>';for(i=0;i<1006;++i)s+='%20';window.location='data:text/html,'+s+'<!doctype%20html><script>document.write(document.compatMode)</script>'

javascript:s='<?>';for(i=0;i<1007;++i)s+='%20';window.location='data:text/html,'+s+'<!doctype%20html><script>document.write(document.compatMode)</script>'

where each should be one line with no spaces. Then I get the
CSS1Compat/BackCompat difference when just copying those into the
location bar, in "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.4)
Gecko/20070515 Firefox/2.0.0.4" and "Mozilla/5.0 (X11; U; Linux i686;
en-US; rv:1.9a6pre) Gecko/20070618 Minefield/3.0a6pre".

(IE7 and Opera 9 don't appear to have any limit on how early the
doctype should appear.)

-- 
Philip Taylor
excors at gmail.com
Received on Monday, 18 June 2007 14:42:46 UTC

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