DOCTYPE and window scrolling break mouse capture positioning in IE6/IE8
713988Oct 6 2009 — edited Sep 14 2010If I specify the DOCTYPE header in my html page the following bug is observed:
If you scroll the browser window down using the scroll wheel or the scroll bar and click on the map, the position is recorded with a vertical offset of the amount in which the window was scrolled. This problem happens in IE6 and IE8 (non compatibility mode) Firefox and IE7 work fine. Removing the DOCTYPE specification from the HTML document resolves the scroll button but causes other HTML compliant styling issues that I would prefer not to tackle.
The doc types that cause the error that I have experimented with:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
or
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
The bug seems to be an IE6/8 bug or abnormality
var mouseLoc = mapview.getMouseLocation();
Some reference to this problem and a low level fix is described here
http://unixpapa.com/js/mouse.html (under Finding Mouse Positions)
I did override a method in the (unfortunately obfuscated) oraclemap.js
Add the following method 'after' loading the oraclemaps.js
This resolves the problem - so far - i am unsure of any side effects it causes.
MVUtil._f175=function(x56)
{
x56=(x56)?x56:((window.event)?event:null);
var x57=0;
var x58=0;
if(x56.pageX)
{
x57=x56.pageX;
x58=x56.pageY;
}
else if(x56.clientX)
{
x57=x56.clientX+document.body.scrollLeft-document.body.clientLeft;
x58=x56.clientY+document.body.scrollTop-document.body.clientTop;
// BUG FIX - Included the scrollTop in the check below....
if(document.body.parentElement&&(document.body.parentElement.clientLeft || document.body.parentElement.scrollTop))
{
var x59=document.body.parentElement;
x57+=x59.scrollLeft-x59.clientLeft;
x58+=x59.scrollTop-x59.clientTop;
}
}
Edited by: user11202763 on Oct 6, 2009 3:09 PM
Edited by: user11202763 on Oct 6, 2009 3:21 PM