[thelist] Always use a DOCTYPE (was: Horizontal scrollbar in IE 6.0)

Mark Howells mark at mountain.ch
Mon Feb 25 17:20:01 CST 2002

>> >> Removing either the DOCTYPE (or the link to the DOCTYPE) means that
>> the
>> browser has no set of "rules" to adhere to when rendering the page.
>>> Not entirely true: they render the page in 'quirks mode'
>> ... which is browser-specific and highly unreliable. While using a
>> will influence Javascript, making sure that the Javascript is "valid"
>> (i.e.
>> that it will work in current and legacy browsers) is a step forwards.
> No, sorry, that's not true. Doctypes have nothing whatsoever to do with
> JavaScript, valid or non-valid (and what does "valid" mean in JavaScript
> anyway?).

Sorry, I was typing and walking out of the door at the same time. What I
was trying to say is that using code that tests for document objects and
methods, rather than user agent strings, is the way to go if you want to
avoid errors.

I don't know about the particular Javascript characteristics that pages
without DOCTYPEs create (that point was put by another list member), but
I've found (since 1996) that using "normal" Javascript and valid HTML
works perfectly in browsers from NN4 to Mozilla 0.9.8. Hacking a page
together using tricks such as the omission of a DOCTYPE rule is a good
way to build unstable pages cross-browser. I'm just trying to flag this
up to list members who are seeing a hack that's suggested on-list, then
using it with abandon and without sight of the consequences six months
down the line.

Mark Howells

More information about the thelist mailing list