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

Ian Hickson ian at hixie.ch
Mon Jun 18 13:12:33 PDT 2007

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.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list