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

2008-04-27 Thread Ian Hickson
On Sun, 3 Dec 2006, Spartanicus wrote:
>
> "Simon Pieters" <[EMAIL PROTECTED]> wrote:
> 
> >The parsing section says that a comment before the doctype may trigger 
> >quirks mode.
> 
> I'm assuming that this comment merely documents IE's current behaviour.
> Please ignore my other comment if I'm wrong.
> 
> >Therefore I think the syntax section shouldn't allow comments 
> >before the doctype (only space characters).
> 
> There are valid reasons to kick IE into quirks mode whilst triggering
> "standards mode" in other browsers. There is existing content on the web
> that intentionally does this. Why would you want to deny an author who
> fully understands the issues from doing this?

Once browsers implement HTML5, there won't be a way to trigger quirks in 
one browser and not another. We want all HTML5 documents to trigger 
standards mode.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


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

2007-06-18 Thread Martin Payne

Philip Taylor wrote:

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




Ah yes, I lost one of the spaces when I unwrapped it. I get the same 
results as you now. :o)


--
Martin Payne

email: [EMAIL PROTECTED]
www: http://www.martinpayne.co.uk/


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

2007-06-18 Thread Philip Taylor

On 18/06/07, Martin Payne <[EMAIL PROTECTED]> wrote:

Philip Taylor wrote:
> In Firefox 2:
>
> javascript:s='';for(i=0;i<1006;++i)s+='
> ';window.location='data:text/html,'+s+' html>document.write(document.compatMode)'
>
> javascript:s='';for(i=0;i<1007;++i)s+='
> ';window.location='data:text/html,'+s+' html>document.write(document.compatMode)'
>
> 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+'document.write(document.compatMode)'

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

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
[EMAIL PROTECTED]


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

2007-06-18 Thread Ian Hickson
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+' html>document.write(document.compatMode)'
> 
> javascript:s='';for(i=0;i<1007;++i)s+='
> ';window.location='data:text/html,'+s+' html>document.write(document.compatMode)'
> 
> 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.   `._.-(,_..'--(,_..'`-.;.'


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

2007-06-18 Thread Martin Payne

Philip Taylor wrote:

In Firefox 2:

javascript:s='';for(i=0;i<1006;++i)s+='
';window.location='data:text/html,'+s+'document.write(document.compatMode)'

javascript:s='';for(i=0;i<1007;++i)s+='
';window.location='data:text/html,'+s+'document.write(document.compatMode)'

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: [EMAIL PROTECTED]
www: http://www.martinpayne.co.uk/


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

2007-06-18 Thread Philip Taylor

On 18/06/07, Ian Hickson <[EMAIL PROTECTED]> wrote:

On Sun, 3 Dec 2006, Simon Pieters wrote:
> Also, as an additional constraint in the syntax section, the entire
> doctype probably should (or must) be within the first 1024 bytes,
> because AFAIK browsers generally only sniff for the first 1024 bytes,
> and if they don't find the entire doctype within that then you get
> quirks mode.

I couldn't reproduce that.


In Firefox 2:

javascript:s='';for(i=0;i<1006;++i)s+='
';window.location='data:text/html,'+s+'document.write(document.compatMode)'

javascript:s='';for(i=0;i<1007;++i)s+='
';window.location='data:text/html,'+s+'document.write(document.compatMode)'

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.

--
Philip Taylor
[EMAIL PROTECTED]


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

2007-06-18 Thread Ian Hickson
On Sun, 3 Dec 2006, Simon Pieters wrote:
> 
> The parsing section says that a comment before the doctype may trigger 
> quirks mode. Therefore I think the syntax section shouldn't allow 
> comments before the doctype (only space characters).

I made a comment not trigger quirks mode. That was a bug.

> Also, as an additional constraint in the syntax section, the entire 
> doctype probably should (or must) be within the first 1024 bytes, 
> because AFAIK browsers generally only sniff for the first 1024 bytes, 
> and if they don't find the entire doctype within that then you get 
> quirks mode.

I couldn't reproduce that. It's possible you were hitting TCP packet 
boundaries, which could indeed make a difference here; however, since the 
DOCTYPE sniffing in the spec is now defined as part of the actual parser, 
it's no longer necessary to have a second pass, meaning we no longer have 
to have a look-ahead buffer and we are therefore not limited by packet 
sizes. Unless an actual site breaks because of this I think we should just 
work with it.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


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

2006-12-03 Thread Spartanicus
"Simon Pieters" <[EMAIL PROTECTED]> wrote:

>The parsing section says that a comment before the doctype may trigger 
>quirks mode.

I'm assuming that this comment merely documents IE's current behaviour.
Please ignore my other comment if I'm wrong.

>Therefore I think the syntax section shouldn't allow comments 
>before the doctype (only space characters).

There are valid reasons to kick IE into quirks mode whilst triggering
"standards mode" in other browsers. There is existing content on the web
that intentionally does this. Why would you want to deny an author who
fully understands the issues from doing this?

-- 
Spartanicus

(email whitelist in use, non list-server mail will not be seen)