Re: Doctype detection

On Thursday, July 27, 2000 at 02:09, jrexon@newsguy.com (Jan Roland Eriksson) wrote:

> Browsers are designed as "non validating SGML systems", that's a fact,
> and let's not fight about that part at least.

I think I've commented in this statement in the past. This is a
generalization which may be true for specific browsers but is not required
to be true. There is no inherent reason why a browser can not be a
validating system (certainly most are not). I'm not even sure that there
currently are no browsers which are validating systems.

> If a document lacks a <!DOCTYPE... declaration, the UA that wants to
> conform to "the backwards compatibility" recommendations, shall infer a
> strict HTML2 DTD reference, and after that? who knows, except for a
> "validating SGML environment" what will happen.

Treating a document as tho it were HTML 2.0 in the absense of a DOCTYPE is
probably in almost every case a worthless thing for it to do. The fact
that HTML 2.0 did not specify a DOCTYPE as being required is an historical
fact but unavoidable. It is however highly regretable.

> But one thing is for sure, after that inference of a <!DOCTYPE... no
> switching into "buggy quirks rendering mode" is to take place...

Of course, here is where your arguement falls apart.

1) Assume a document has no DOCTYPE

2) According to the full history of HTML this document should be assumed
to be HTML 2.0 (since all other versions since then require a DOCTYPE).

3) If the document parses as valid HTML 2.0 then the web browser should do
the right thing. If you have a document which validates as HTML 2.0 but
yet isn't handled in a proper manner by a shipping web browser, file a bug
report.

4) And this is the kicker, if the document does not validate as HTML 2.0,
the browser is free to do any darn thing it wants and still be a
conforming UA since the behaviour of the UA in the presense of an error is
undefined.

So, if the document has no DOCTYPE and doesn't validate as HTML 2.0 is may
do what it wants. If the file has a DOCTYPE but doesn't validate against
the specified version of HTML it can do what it wants.

The only cases where the UA is constrained is

a) When the document has no DOCTYPE and validates as HTML 2.0
b) The document has a DOCTYPE and validates against the specified 
   version of HTML.

In either case if the UA doesn't perform up to snuff file a bug report.
Otherwise the browser gets to do what it wants.

> If the browsers gets a text/html doc over HTTP and knows how to get a
> linked stylesheet as a text/css doc in the same way, the browser is
> obliged to use the info it gets to the best of its capability, totally
> regardless of the existence of an original <!DOCTYPE... declaration or
> just an inferred <!DOCTYPE...

Not at all. If there is no DOCTYPE the browser is not obliged to do any
such thing since there is not any support for CSS in HTML 2.0.

If there is a DOCTYPE the browser is only obliged to do any particular
thing if the file actually validates as the version of HTML specified in
the DOCTYPE.

> >...how would you suggest browsers should detect whether to use
> >their quirks mode or their standard compliant mode?
> 
> This is a repeat, sorry (it's in Bugzilla too, since long back)
> 
> My initial suggestion has been as follows...
> (top to bottom priority)
> 
> 1) Create the required part of the UI that lets the user
>    decide for him/her self.

Sorry, what do you mean by "required part of the UI"? Required by what?

> 2) Define a specific HTTP1.1 extension header that authors
>    can use to send an indication about what might be a good
>    choice of rendering mode.

What does this solve? How is the author supposed to know what "rendering
mode" the browser should use? How is the author supposed to know what
rendering modes are available. Why doesn't the author just write valid
HTML is the first place?

> 3) Let the browser look for a META HTTP-EQUIV entry in the
>    markup to give the same effect as 2) above, and follow that
>    one, before...

See answer to #2 above.

> 4) ...using <!DOCTYPE... sniffing for any purpose at all...

Still seems the most reasonable approach to me. 


-- 
Christian Smith  |  csmith@barebones.com  |  http://web.barebones.com
PGP Fingerprint  -  60E5 2216 97D2 1D1A B923 F036 00A9 CEC0 D411 FA89

Received on Wednesday, 26 July 2000 23:31:05 UTC