W3C home > Mailing lists > Public > public-html@w3.org > February 2010

Re: Legacy Doctype and Doctype Versioning

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Thu, 18 Feb 2010 01:01:21 +0100
To: Krzysztof Maczyński <1981km@gmail.com>
Cc: Philip Taylor <pjt47@cam.ac.uk>, public-html@w3.org
Message-ID: <20100218010121863991.5635f637@xn--mlform-iua.no>
Krzysztof Maczyński, Wed, 17 Feb 2010 21:41:03 +0100:
>>> ...just trying to understand... a DOCTYPE that previously triggered 
>>> standards mode will now (as in FF trunk + HTML5 parser) get you to 
>>> Quirks mode?
>> Yes, but in pre-HTML5 browsers (IE, Firefox 3.6 without html5.enable, 
>> etc) doctypes will still only be parsed up to the *first* ">", so you 
>> will get the characters "]>" inserted as text into the body of the 
>> document, so today you can't use internal subsets in text/html anyway.
> I actually use internal subsets, very occasionally, and then usually 
> make sure that those characters won't be visible if some UA 
> erroneously renders them. Most often by covering with some element's 
> box using CSS. 

Perhaps JavaScript could be used as well.

> Thanks, Leif, for your clever solution at 
> http://www.målform.no/html4-or-html5/take2_workaround which looks 
> both cleaner and more universal. Have you got an explanation handy? 
> As SGML I understand it but not how mainstream browsers parse it.

I guess the "research" is not ready yet. And I've tried many variants - 
there is more than one that works. And perhaps the above is not the 
final variant. Of course, the goal has been to make it as short and 
"logical" as possible. Attempt to explain:

	Line (3): "#implied -->" Browsers see a comment end; "<!>" See more 
below.; "<!-- >]>" Browser see comment start;
    Line (4): Web browsers think that the comment ends on this line. In 
the last part, "<!!-->", the two "!!" causes Firefox to not show the 
"]>". Why? Why not? ;-)
	Line (5): If your text editor has better syntax coloring than mine, 
then you can skip this line - it is purely there to "repair" VIM's 
syntax coloring behaviour.

Safari is an extra funny boy here: It treats '<!-->' as a full HTML 
comment. And this is also specced in the HTML5 draft. This has all 
kinds of funny effect. But a "positive" effect ... is that it you can 
trigger standards mode in Safari this way (effectively turning 
quirks-mode doctypes into standards-mode doctypes - only in Safari):

	<!--><!DOCTYPE HTML><!-->

So, what I don't tell on the test page is that the following variant 
triggers standards mode in Safari:

 [<!ATTLIST P myattr CDATA #implied --><!DOCTYPE HTML><!-- >]>

PS: When I had more than one <!ATTLIST ....> inside the [], then it 
seemed like one even more simply could hinder the "]>" from displaying. 
(I guess I must document this somewhere else.)
leif halvard silli
Received on Thursday, 18 February 2010 00:01:57 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:58 UTC