A LIST Apart: For People Who Make Websites

No. 142

Discuss: Fix Your Site With the Right DOCTYPE!

Pages

 <  1 2 3 4 5 >  Last »

21 Use the Links, Luke

Wonderful comments, and thanks for catching the typo, Matthew.

Several questions raised here are answered in documents linked from the article.

For instance, the optional xml prolog causes problems in many browsers, not just IE6. Though it’s part of the XHTML standard, it’s an OPTIONAL part, precisely because its use causes problems in old browsers as well as some new ones.

This is covered in more detail in the XHTML Guidelines section of the NYPL Style Guide: http://www.nypl.org/styleguide/xhtml/guidelines.html

The Style Guide is linked from the article, and the XHTML Guidelines section is linked from “Better Living Through XHTML” (which is linked from the article).

posted at 06:03 am on April 12, 2002 by Jeffrey

22 When will we get a strictly rendering user agent?

now that we can render in a more compliant way, does anyone know when we can expect to see a strictly rendering browser?

as a developer, i would personally like a developer version of a browser which takes no crap from me and chokes up and any non-compliant mark-up. really i’d like it to help me force the developers i work with into doing basic stuff like closing tags and proper nesting :P

seriously though, has anyone heard of such a user-agent? i’ve played with amaya (from the w3c), but its results are sometimes bafling and i wonder how correct they are.

posted at 06:11 am on April 12, 2002 by Janos Erdelyi

23 Umm, this is an article?

I’m sorry, but all this article does is complain about how so many Web sites don’t use proper doctypes, then goes and provides a list of doctypes, that were already available in many other places on the Web. Where’s the beef, Zeldman?

A perfect example:

IE reverts to the IE DOM; Mozilla and Netscape 6 revert to who knows what.

Umm, well, why don’t you ask them? This is called “Lazy author’s syndrome,” and is consistent with many articles you find online. It’s when the author is too lazy to either find out the complete information and provide a much more robust and helpful article, or to simply leave out the unhelpful snide remarks.

Where is the discussion about all those folks who are using incorrect doctypes on purpose? I know some big-name shops (such as IBM) where the DOCTYPE tag is purposely incomplete so they can get IE-specific features like changing scrollbar colors.

I’m disappointed by this article. It looks like a combination rant and cut-and-paste from other places on the Net, and is trying to pass for something semi-original. It’s not. It’s a hack job at it’s worst.

posted at 06:12 am on April 12, 2002 by David Harris

24 This is a service, David.

Two hours before this article went live, I was contacted by a standards-aware developer who wondered if I knew why his carefully authored site was displaying incorrectly in Mozilla 0.9.9. I did. The answer was in this article. Despite all his knowledge and care, this developer had used the wrong DOCTYPE because that’s what he found at the source (W3C).

The HTML editors I use contain incomplete DOCTYPEs that trigger Quirks mode in all standards-compliant browsers but Opera (which avoids DOCTYPE switching, per the article).

These HTML editors are market-leading products, developed over years, by people who care about proper web authoring. They contain the wrong DOCTYPEs because a straightforward listing of proper DOCTYPEs is currently impossible to find at the source (W3C).

W3C standards (and other standards) are essential to the growth of the web, but w3.org’s Information Architecture leaves something to be desired, as they will be the first to admit. And this is so for the reasons stated in the article (W3C is not a tutorial site, it’s a repository for a huge and growing collection of deeply geeky documents.)

David, you may have known where to find all the proper DOCTYPEs, but I didn’t until I did the research for this article, and neither do many working web designers and developers (as well as some leading software makers). This article is intended as a service to the working designer and developer — folks who don’t have time to hunt down this information in various scattershot locations, and will appreciate its being made available in one place.

Also, I think you’ve mistaken editorial focus for “laziness.” This little article is intended to do one thing: give readers the proper DOCTYPEs. They don’t need a multi-paragraph digression on what previous DOM Mozilla/Netscape 6 may revert to if the wrong DOCTYPE is used. All they need to know is that, with the right DOCTYPE, Mozilla/Netscape 6 will support the W3C DOM.

If you’re looking for a more extensive and more detailed examination of web standards in browsers, you’ll find many such articles in the PREVIOUS STORIES section of this magazine.

posted at 06:43 am on April 12, 2002 by jeffrey

25 Troubleshooting DOCTYPES

One way to play around with all the different DOCTYPES is to go to the W3C’s Validation page (http://validator.w3.org/) & paste in your URI. The page allows you to select different DOCTYPES in order to check the validity of the code you’ve written.

Also, if you check the “Show Source” box, the exact DOCTYPE syntax will appear in the result for cut & paste fun.

Great article – something that needed to be addressed. Thanks.

posted at 07:47 am on April 12, 2002 by saturdave

26 DOCTYPE to Break Javascript

What do you now of DOCTYPEs breaking JS functions?

I am trying to create a JS persistent nav bar in the spirit of the GeoCities watermark and once I insert the XHTML Transitional DOCTYPE into my document, the script no longer works.

========
Example JS :
========
http://builder.cnet.com/webbuilding/0-7690-8-5934478-9.html?tag=st.bl.7310.dir1.7690-8-5934478-9
========

posted at 08:35 am on April 12, 2002 by Craig Shoemaker

27 Any advantage to posting DOCTYPEs locally

Thanks for the helpful article. It answered several questions I had. But I’ve got one more.

Does anyone know if there’s and advantage to copying the DOCTYPEs from W3C and posting them locally?

Do the browsers actually go look at the W3C DOCTYPEs? Or are the browsers just reading the URIs like they would a tag? In which case posting the DOCTYPEs locally would render them useless.

posted at 10:58 am on April 12, 2002 by Craig Ramsdell

28 DOCTYPEs and viewports

1. Are you using embedded scripts? The example at the above URL uses a script tag with the comment-hiding trick. This will make a true XML parser ignore the entire script, as XML parsers cannot treat script and style tags as containing anything but XML. There are ways to make the comment-hiding hack work in both HTML and XML at the same time, but it’s not pretty. Try removing the comment hack or, best, using an external script instead.

2. The script contains an ETAGO sequence (</) in the comment at the top, which is invalid if included in an embedded script block in legacy HTML. It won’t cause any common browsers to choke though.

3. If you use a DOCTYPE that triggers Standards Mode in IE6, the element that represents the viewport is (correctly) ‘html’, not ‘body’. Thus the element whose scroll position you have to measure is html not body. The line:

innerWidth = document.body.clientWidth;

would have to be replaced with something that would detect whether it’s IE6 running in Standards Mode, or plain old quirky IE5, and find the right element:

innerWidth= ((document.compatMode==‘CSS1Compat’) ? document.documentElement : document.body).clientWidth;

4. Ignore any quotes on the end of my e-mail and web addresses, I’m checking to see if this new board is as susceptible to JavaScript injection hacks as the last one. :-) oh, and to which end, http://www.example.com/test

posted at 10:59 am on April 12, 2002 by Andrew Clover

29 Is the line wrap required?

One hting I’ve never been able to figure out is whether or not the line wrap and the tab white space on the second line is required. For coding sake, espeically on my dnamic sites I’d prefer to have it all on one line.

Also, another reader above asked if the browser actually goes to the url in question. I don’t think it does in certain cases (when you use the ones listed in the article) but does it if you put another address in there? That could be an issue one might need to consider on an intranet where the DTD might be on the other side of the firewall.

posted at 11:34 am on April 12, 2002 by J

30 Does capitalization matter?

Am I the only one who is havig trouble validating XHTML 1.0 Transitional documents using the provided DTD? I get [b]Error: DTD did not contain element declaration for document type name[/b] if I don’t change the “DOCTYPE HTML PUBLIC to “DOCTYPE html PUBLIC

posted at 12:04 pm on April 12, 2002 by J

Pages

 <  1 2 3 4 5 >  Last »

Discussion Closed

New comments are not being accepted, but you are welcome to explore what people said before we closed the door.

Got something to say?

Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.

Create a new account or sign in below if you’d like to leave a comment.

Remember me

Forgot your password?

Subscribe to this article's comments: RSS (what’s this?)