[whatwg] doctype parsing

Olav Junker Kjær olav at olav.dk
Sun Aug 1 11:56:28 PDT 2004


This is not really a WF2-specific question, but since the spec also
clarifies some undefined parts of HTML, I thing it might be relevant anyway.

Is comments allowed before the doctype in HTML? In MSIE, a strict doctype
preceded by a comment will not trigger standards mode, but in Mozilla it
will. From the HTML 4 spec, its not clear whether comments is allowed
before the doctype. (Of course this must be defined somewhere in SGML, but
is seems that with XHTML appendix C, HTML has officially cut its ties to
SGML?)

If comments is allowed before the doctype, it enables an ugly but useful
hack in IE: with the WHATWG doctype, a document is rendered in standard
mode, however if a comment precedes the doctype, the document is rendered
in quirks mode. This might be useful if legacy pages is upgraded to WF2.

Olav Junker Kjær





More information about the whatwg mailing list