Late into this project I decided to see what effect including the !DOCTYPE compliance statement would have. For those who may not be aware, this HTML tag must be first statement of a web page (even before the <HTML> statement) and takes the form:
As explained above, YAMF retrieves the browser's canvas limits (display width/height) to perform clipping on elements that have moved outside them in order to prevent automatic scrolling in DOM2 browsers. However, Internet Explorer 6 no longer returns the correct canvas dimensions using the body style sheet properties if !DOCTYPE is set with compliance. Rather, it uses the newly created html style sheet properties (represented by document.documentElement.) For scroll canvas properties, whenever one is relevant the other is set to zero. Thus, one can include both in a computation in additive manner and expect to get the correct scroll value. However, this is not the case with the body style sheet clientWidth and clientHeight properties, which are set to values even in compliance mode. Thus, when computing the canvas limits for Internet Explorer 6, first attempt to get the html document.documentElement.clientWidth and document.documentElement.clientHeight properties and if set to zero, then retrieve the document.body.clientWidth and document.body.clientHeight properties instead. This is not an issue with Netscape 6 and was never a problem with Netscape 4.
Below is a script function that demonstrates how to retrieve the mouse position on a mousemove event:
While Netscape 6 didnít exhibit the above problem, it did have its own peculiar constraint while running in compliance mode; specifically, assigning positional values to the elements left and top style sheet properties. According to the CSS1 specification, length value assignments must have the unit type as part of the assignment (e.g., px, in, cm, mm, pt, pc.) As of Internet Explorer 6.0PR2, non-unit values default to pixel units (px); however, Netscape 6 doesnít accept non-unit values. Also, Netscape 4 must have non-unit values. Lastly, if not in compliance mode, all of the browsers accept the non-unit values. So, the safest way around this problem is to assign unit types for all DOM2 enabled browsers and non-unit values to others.
Below is a script scrap that avoids this problem using the px unit type:
YAMF - "Yet Another Mouse Follower"
All Is Not What It Seems
Netscape 6 Made Me Do It!
Testing - To Reload or To Restart?
Browser Sniffing - Parse or Presence?
Stopping Annoying Auto-Scroll in DOM2 Browsers
Netscape 6 is Pixel Picky
Inline Style Constraint on Internet Explorer 5
Must Use <LAYER> tag in Netscape 4 to perform DHTML
!DOCTYPE Compliance Mode
Take Care Not to Render in <HEAD> Section
Automatic Expansion of Relative URLs
The Elusive Netscape 4 Layer Elements
Temperamental onLoad After Reload
document.images[id].complete Property Dependency
Search Method Does Not Return Boolean Value
Regular Expression Global Flag Fails With Subsequent Usage
Roll Your Own
|Copyright © 2002-2003, ProjectIt, All Rights Reserved||Last Revised:|