[jQuery] event.pageX/Y in IE

[jQuery] event.pageX/Y in IE


I am not sure how I missed this early in my plugin development, but I
see it now.
For my new hover plugin, I noticed jQuery was extending the event
structure with extra mouse information such as:
event.pageY and event.pageX
and that this extended event is passed to my show and hide handlers.
Well, to make a story short, after working out my plugin logic for
screen and viewport dimensions, compensating for scrolls, etc, testing
it under IE, I see that the event pass to me show handler does not
have the extended information.
In other words, in my function callback:
function handleShow(e)
{
var mX = e.pageX;
var mY = e.pageY;
...
}
Under IE, the mouse X/Y variables are undefined.
To fix it, I had to copy some "fix" method logic in jQuery that checks
and sets the event.pageX/Y properties, like so:
function fixEvent(e)
{
// Calculate pageX/Y if missing and clientX/Y available
// note: IE seems to be the only one that needs this because
// jQuery will add it for others. Don't know why not
// for IE.
if ( e.pageX == null && e.clientX != null ) {
var e = document.documentElement, b = document.body;
e.pageX = e.clientX + (e && e.scrollLeft || b.scrollLeft || 0);
e.pageY = e.clientY + (e && e.scrollTop || b.scrollTop || 0);
}
return e;
}
function handleShow(e)
{
e = fixEvent(e)
var mX = e.pageX;
var mY = e.pageY;
...
}
Again, I don't know how I missed this early on because I was testing
IE and FF as I was doing my work. But in the final analysis, this
is the behavior I am seeing under IE only.
Why would jQuery not set the extended event info with IE?
Thanks in advance.
--
HLS