Click here to get back home

Re: DTD in browsers

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Re: DTD in browsers Henri Sivonen 05-03-2006
Posted by Henri Sivonen on May 3, 2006, 4:24 pm
Please log in for more thread options

> Randy Webb wrote:

> > So you are saying it totally disregards the DTD and any hints from the
> > server how to handle the document?
>
> Except server reported Content-Type (text/plain, text/html, text/xml,
> application/xhtml+xml etc.)
> DTD string itself is irrelevant (and this string by itself is not a
> "hint from the server" but a "hint from the document").

The DTD is irrelevant (it is not fetched). However, for text/html, the
doctype is relevant:
http://hsivonen.iki.fi/doctype/

> They have some theoretical importance for documents' indexing and
> searching.

No, they do not.

> Most importantly DTD allows - so far - to switch IE into W3C
> box model (unless short HTML Transitional).

And Firefox. And Opera. And Safari.

> WWW doesn't go by extensions or formal document signs, never did and
> never will. The only important part is Content-Type. It defines
> everything.

Except, of course, when it doesn't.

> > > And if anyone curious: the build in DTD of IE6 is
> > > <http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd> This is the
> > > only one it's aware of and the only one it uses.

IE does not have built-in DTDs at all. The parsing is not DTD-based.

--
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Posted by VK on May 3, 2006, 5:07 pm
Please log in for more thread options
Damn, somebody messed up followups... must be me... sorry


Posted by Henri Sivonen on May 3, 2006, 5:38 pm
Please log in for more thread options

> Henri Sivonen wrote:
> > The DTD is irrelevant (it is not fetched). However, for text/html, the
> > doctype is relevant:
> > http://hsivonen.iki.fi/doctype/
>
> Not for IE6... "not exactly" for a better wording. This browser has
> four options for two states (backCompat and CSS1Compat):

Let me guess. You did not read the document referenced above.

> Option 4: Any text within <!.. > brackets as the first line in the
> document except Option 2
> compatMode -> CSS1Compat == W3C box model

Like <!DOCTYPE HTML PUBLIC "ISO/IEC 15445:1999//DTD HTML//EN"> perhaps?
;-)

> This way in XHTML agglomerate like
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> it sees only the last <> pair and goes by Option 4.

Are you sure?

> > > Most importantly DTD allows - so far - to switch IE into W3C
> > > box model (unless short HTML Transitional).
> >
> > And Firefox. And Opera. And Safari.
>
> No, because it's impossible. Firefox and others do not have IE box
> model one could switch on or off. They have only one box model -
> irrelevant of DTD.

Actually, earlier versions of Opera did have the IE box model in the
quirks mode. My point was that even though they don't have the exact IE
box model quirks, they do doctype sniffing nonetheless.

> > > WWW doesn't go by extensions or formal document signs, never did and
> > > never will. The only important part is Content-Type. It defines
> > > everything.
> >
> > Except, of course, when it doesn't.
>
> As if?

http://ln.hixie.ch/?start=1144794177&count=1

> > > > > And if anyone curious: the build in DTD of IE6 is
> > > > > <http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd> This is
> > > > > the
> > > > > only one it's aware of and the only one it uses.
> >
> > IE does not have built-in DTDs at all. The parsing is not DTD-based.
>
> Of course it does: otherwise how it would decide that tag to render and
> how, what attributes to use for rendering and what to disregard?

From hand-crafted C++ code and from CSS.

--
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Posted by Henri Sivonen on May 5, 2006, 11:43 am
Please log in for more thread options

> Henri Sivonen wrote:
> >
> > > Henri Sivonen wrote:
> > > > The DTD is irrelevant (it is not fetched). However, for text/html, the
> > > > doctype is relevant:
> > > > http://hsivonen.iki.fi/doctype/
> > >
> > > Not for IE6... "not exactly" for a better wording. This browser has
> > > four options for two states (backCompat and CSS1Compat):
> >
> > Let me guess. You did not read the document referenced above.
>
> Now I did. It is a nice table there, but AFAICT you build it with the
> same wrong assumption of how really DTD sniffing works, at least in IE.

What's my wrong assumption?

If you believe that the quoted "The DTD is irrelevant (it is not
fetched). However, for text/html, the doctype is relevant" is my wrong
assumption, I assure you that the assumption is right as far as
text/html in IE goes and you need to be more precise about the words
doctype and DTD.

> Without it it will be just a record of test results, not an
> explanation.

Explaining the exact inner workings is not the goal of that document.
The goal of the document is to
a) explain why weird stuff happens (to people who don't
realize doctype sniffing is taking place)
b) motivate people to use the Standards more or at least
the Almost Standards mode.
I believe I give enough facts to meet these goals. I am deliberately
withholding details that I believe would either obscure the main point
or would make people feel too confident about deliberately using the
Quirks mode or deliberately using a doctype other than the two I've been
recommending for almost six years now.

(I will recommend the HTML5 doctype, when the spec stabilizes.)

> The real explanation and relevant links see in my post in
> this thread.

FWIW, I have read the relevant code from the Gecko and WebKit codebases.
(Have you?) I don't have access to the code of Opera, Mac IE 5 or
Windows IE 6, so I could only speculate based on black box testing.
While it would be interesting for the curious, I fail to see why J.
Random Web author would need to see that speculation.

> Your table also doesn't tell anything about "Unrecognized DTD"
> situation, thus about even perfectly valid DTD but not from W3C lists.

I have left it out deliberately in order to discourage people from using
them.

> It is often forgotten but DTD files creation is not an exclusive right
> of W3C. Everyone is welcome (and it's widely used in XML) to create own
> DTD's for a particular set of documents.

Homegrown DTDs for XML are legitimate for XML (but still arguably a bad
idea on the Web). It is not so clear whether homegrown DTDs are
appropriate for text/html.

> > http://ln.hixie.ch/?start=1144794177&count=1

> But I would guess that the author simply mis-interpreted the
> rumors about hackers attacks using Content-Type tricks.

He wasn't going by rumors. He has actually worked for Netscape and Opera
and also followed the bug database of Safari.

--
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Posted by VK on May 5, 2006, 12:45 pm
Please log in for more thread options

Henri Sivonen wrote:
> What's my wrong assumption?

That browser indeed treats quoted part of DTD as a unit (a la opaque
strings in namespace declarations). Sorry if I'm wrong and it was not
your assumption.

> FWIW, I have read the relevant code from the Gecko and WebKit codebases.
> (Have you?) I don't have access to the code of Opera, Mac IE 5 or
> Windows IE 6, so I could only speculate based on black box testing.
> While it would be interesting for the curious, I fail to see why J.
> Random Web author would need to see that speculation.

I see... Ignorance is the bless ;-)

> > Your table also doesn't tell anything about "Unrecognized DTD"
> > situation, thus about even perfectly valid DTD but not from W3C lists.
>
> I have left it out deliberately in order to discourage people from using
> them.

I see... Ignorance is the bless ;-)

> > It is often forgotten but DTD files creation is not an exclusive right
> > of W3C. Everyone is welcome (and it's widely used in XML) to create own
> > DTD's for a particular set of documents.
>
> Homegrown DTDs for XML are legitimate for XML (but still arguably a bad
> idea on the Web). It is not so clear whether homegrown DTDs are
> appropriate for text/html.

Proprietary DTD's are fully OK for XML, thus for XML+XSL transformers.
It can be a transformer producing the resulting document of type
text/foobar and respective DTD defining element <foobar> with allowed
attributes CDATA foo and logical bar. That is pretty close to how
Windows Vista file management will work - thus some part of Web
resources. But you may expect at the very least another year of
peaceful life :-)

> > > http://ln.hixie.ch/?start=1144794177&count=1
>
> > But I would guess that the author simply mis-interpreted the
> > rumors about hackers attacks using Content-Type tricks.
>
> He wasn't going by rumors. He has actually worked for Netscape and Opera
> and also followed the bug database of Safari.

Then his statement gets really strange - especially when anyone can
prove it wrong. The very same intentionally broken XHTML document (no
closing tag in list elements) demostrates completely different behavior
if served with Content-Type text/html:
<http://www.nskom.com/external/tmp/html/xhtml.html>
and with Content-Type application/xhtml+xml
<http://www.nskom.com/external/tmp/xhtml/xhtml.html>

I'm very far of thinking that the author is not current on the subject.
Then it may be explained by his bias. Maybe it's all about your
discussions here about XHTML served with text/html Content-Type. In
such case the mentioned article would be an attempt to "bring a peace
into starving souls" :-) Like if Content-Type is meaningless and
disregarded anyway, then it's not important what Content-Type to use.
The next logical conclusion out if it would be to try to serve
documents without Content-Type at all - let UA bothers with it by
formal signs. Anyone tryed it already?


Similar ThreadsPosted

or
June 19, 2007, 1:12 am
Re: DTD in browsers May 4, 2006, 3:30 am
" last word 3 browsers July 8, 2005, 7:51 am
What browsers are using to test? February 20, 2006, 9:50 am
Dynamic Menu for all browsers October 7, 2004, 2:10 pm
Different browsers render differently October 26, 2004, 4:50 pm
Controlling web browsers with META January 22, 2005, 12:43 am
XHTML authoring and browsers November 26, 2005, 1:48 pm
Inconsistent Display in Different Browsers December 7, 2005, 7:06 pm
Help! new site is crashing IE browsers! November 17, 2006, 10:38 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap