spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com


home / experts / dhtml / column60

Developer News
Google Going Native With Chrome
Mozilla Fixes Firefox Flaws as 3.5 Release Nears
Microsoft and Novell Still Bosom Buddies

Logo

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



Sack the Hack

With the release version of IE6, the document.doctype property has been documented:

MSDN document.doctype Documentation

What we learn from the documentation is that the behavior of the property has changed in IE6 release:

"For HTML documents the doctype property returns null as defined by the World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 standard."

Our hack, therefore, will no longer work. We cannot use document.doctype to determine the existence of a DOCTYPE declaration in IE6 release. Whereas once it was a robust property/object with information-rich properties of its own, it is now simply a placeholder of sorts. Previously, it would return null only if no DOCTYPE declaration was present, now it always returns null.

Admittedly, we didn't want to use the hack in the first place. The reason we developed it was because there was no documented way to identify a defined DOCTYPE declaration or which rendering engine IE would use to lay out the page.

The good folks at Microsoft, however, have realized the importance of a rendering-engine-identification property and consequently they have introduced the spanking-new document.compatMode property. You can read all about it here:

MSDN document.compatMode Documentation

document.compatMode

document.compatMode is a read-only property that currently returns one of two string values:

BackCompatStandards-compliant mode is not switched on.
The IE-specific element rendering, available since IE4, is used.
CSS1CompatStandards-compliant mode is switched on.
A different, standards-compliant, rendering engine is used. Previously this engine was available only in IE5 for Macintosh.

By checking the value of document.compatMode, we can point IE6 to the IE-specific or standards-compliant statements in HM_ScriptDOM.js, just as we do for IE5Mac using document.doctype.

The complete list of CSS-enhancements introduced in IE6 can be found in this must-read document:

MSDN IE6 CSS-Enhancements Documentation

The above MSDN document includes a useful table which is reproduced on the next page in an expanded version.


Produced by Peter Belesis and

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
XML and PHP Simplified · Creating a ASP.NET Contact Form · Data Filtering with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Intel to Host Live Nehalem Q&A · 12 Tips to Troubleshoot Network File-Sharing · 10 Tips for Selling on Kijiji

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

URL: http://www.webreference.com/dhtml/column60/4.html