Hiermenus Go Forth, XXIV - DHTML Lab | 6 | WebReference

Hiermenus Go Forth, XXIV - DHTML Lab | 6


Logo

Hiermenus Go Forth, XXIV:
Version 4.1.2 - The Complete Script (Full-Window)



Déjà Vu

Those of you who have been following the development of HM religiously may recall that we addressed the exact same positioning problem for IE5Mac and IE6Win beta in Version 4.0.8.

Here is how we described the problem and the solution we implemented at that time:

In IE5Mac, some pages would display menus with bad widths, heights and image positioning. In fact the menus would look completely wonky. The same menus on other pages would be perfect! This same problem also occurs in IE6Win beta.

This is the same problem we had in Version 3 and addressed in the FAQ, as FAQ#13. Please read the FAQ for background to the problem. The answer we gave then is modified and reprinted here:

IE5 for the Macintosh has been universally acclaimed as the most standards-compliant browser released from the "big two" vendors. For example, see WebReview's CSS support table. Its support of the HTML 4 standard is also the most W3C-compliant.

In many cases, its support may be "too" good.

Many authors are now using the DOCTYPE tag at the beginning of their documents to define the Document Type Declaration (DTD) that the document adheres to. If you are unfamiliar with DOCTYPE and DTD's, there is a useful overview on HTML with Style that will bring you up-to-date quickly.

Here is an example DOCTYPE tag:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
       "https://www.w3.org/TR/REC-html40/loose.dtd">

Many third-party HTML editors add DOCTYPE to the beginning of documents automatically. Authors rarely exclude it from pages where it has been inserted automatically, because more often than not they regard DOCTYPE as "harmless overhead." Until the release of IE5 Macintosh, DOCTYPE was truly a "vanity tag," like many of the META tags identifying page-creation software, since no browser from Microsoft or Netscape parsed it in any useful manner.

IE5 Macintosh and IE6Win read DOCTYPE and if a DTD URL is specified, load the DTD and compare your document's syntax against it. If your document does not comply completely with the DTD, a syntax error may be generated.

Even if your syntax is correct, the DTD may force the browser to render elements differently than if no DTD was included. For example, IE renders element width and padding in a non-W3C-standard way. However, if you include a DTD URL, IE changes the rendering to the standard way.

In the case of the HM script, it means that if a DTD URL is included, IE5Mac and IE6Win beta will render just like Gecko (NS6). Without the DTD URL, they will render like IE4/5Win.

This is not a problem since authors test their pages and can adjust their values. With HM, and other similar third-party scripts, the host page make-up is unknown. We need to allow these IE "DTD browsers" to use either of two value sets, depending on the existence or not of the DTD URL.

We have done just that in Version 4.0.8, by checking for the existence of a DTD URL using the document.doctype object. The official Microsoft documentation states that document.doctype is available only in IE6Win. In reality, it has already been made available in IE5Mac, and exists in Gecko as well.

By parsing the as-yet-undocumented name property of document.doctype we can ascertain the inclusion of a DTD URL. Now, we can easily point the browser to the relevant values to use for sizing the elements.

In 4.0.8, we fixed the problem for IE5Mac and IE6Win beta but, alas, not for IE6Win release.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: October 30, 2001
Revised: October 30, 2001

URL: https://www.webreference.com/dhtml/column60/3.html