Re: Intent to Conform (was Re: Version information)

On Thursday 2007-04-12 11:01 -0700, Chris Wilson wrote:
> Maciej Stachowiak [mailto:mjs@apple.com] wrote:
> >Fair enough, but <!DOCTYPE html> has the significant advantage that
> >it triggers standards mode in current browsers, so it's easier to
> >make content that degrades gracefully. I don't think <!DOCTYPE html5>
> >would.
> 
> Umm, it does in IE.  And I'd expect it to in any other browser, too - it's an unknown doctype.

It's an incorrect DOCTYPE declaration (since the name given doesn't
match the root element for the document format).  Would you expect
"<!DOCTPE html>" (missing "Y") to trigger standards mode?  What
about "<!html>"?  What about "DOCTYPE" without any markup around it?

Perhaps that was a mistake, but the basic idea of Mozilla's quirks
mode selection code (which I wrote) is:

 1. Parse the doctype.  If we can't (e.g., if it's not present or
    malformed), use quirks mode.

 2. If that succeeds, see if it's one of the known public
    identifiers that's quirks mode (or almost-standards mode), some
    of which are quirks mode only when used without a system
    identifier.  Choose the mode appropriately, using standards mode
    for any unknown public identifiers, any DOCTYPE declarations
    without a public identifier, and any DOCTYPE declarations with
    an internal subset.

The details are documented at
http://developer.mozilla.org/en/docs/Mozilla's_DOCTYPE_sniffing .

This triggers quirks mode because it fails in step (1).

-David

-- 
L. David Baron                                <URL: http://dbaron.org/ >
           Technical Lead, Layout & CSS, Mozilla Corporation

Received on Thursday, 12 April 2007 18:20:03 UTC