Re: Legacy Doctype and Doctype Versioning

Leif Halvard Silli wrote:
> Maciej Stachowiak, Wed, 20 Jan 2010 19:15:02 -0800:
>> I suspect most people know this, but just to be clear, the HTML 4.01
>> Strict DTD will *not* trigger quirks mode.
>
> No, Maciej, this is not correct. Anymore.
>
> Not in Safari 4. In the current version of Safari, this variant of the
> strict Doctype triggers QuirksMode:
>
>  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>  [<!ATTLIST P myattr CDATA #implied>]>

This is a bogus DOCTYPE in HTML5 because there is no support for parsing 
the SGML syntax for the internal subset in the HTML serialisation.  The 
HTML5 parsing algorithm states for this particular doctype, during the 
_between DOCTYPE public and system identifiers state_, when it 
encounters the '[' ("Anything else" option):

   "Parse error. Set the DOCTYPE token's force-quirks flag to on.
    Switch to the bogus DOCTYPE state."

The _bogus DOCTYPE state_ then consumes everything up to and including 
the first '>', and then the trailing ']>' gets consumed in the _data state_.

As a result, Minefield with HTML5 parsing enabled will also use quirks 
mode for this DOCTYPE.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Wednesday, 17 February 2010 09:09:29 UTC