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:
>  [<!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

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