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

Philip Taylor excors+whatwg at gmail.com
Mon Jun 18 14:00:31 PDT 2007

On 18/06/07, Ian Hickson <ian at hixie.ch> 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:



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
excors at gmail.com

More information about the whatwg mailing list