Side navigation
#7319 closed bug (patchwelcome)
Opened October 26, 2010 03:11PM UTC
Closed September 08, 2011 06:31PM UTC
Last modified March 14, 2012 12:58AM UTC
IE: event.pageX and event.pageY not using scroll if element belongs to a different document
Reported by: | bgrins | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | event | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I ran into an issue in IE where the pageX and pageY were not being computed properly (that is, not consistent with native pageX/pageY calculations from other browsers).
Test Case: http://jsfiddle.net/nfyVy/
Inside event.js, this small change seems to fix it:
if (event.pageX == null && event.clientX != null) { var ownerDoc = event.target.ownerDocument || document; var doc = ownerDoc.documentElement, body = ownerDoc.body;
EXCEPT:
When there is a frameborder on the frame, the ownerDocument has a clientLeft of 2, so everything is shifted by 2px (for example, if you are at the position (0, 0) the pageX/pageY are -2/-2. I'm not sure why it is using this clientLeft property anyway, can anyone explain?
Attachments (0)
Change History (3)
Changed October 26, 2010 03:54PM UTC by comment:1
component: | unfiled → event |
---|---|
description: | \ I ran into an issue in IE where the pageX and pageY were not being computed properly (that is, not consistent with native pageX/pageY calculations from other browsers). \ \ Test Case: http://jsfiddle.net/nfyVy/ \ \ Inside event.js, this small change seems to fix it: \ \ {{{ \ if (event.pageX == null && event.clientX != null) { \ var ownerDoc = event.target.ownerDocument || document; \ var doc = ownerDoc.documentElement, body = ownerDoc.body; \ }}} \ \ EXCEPT: \ When there is a frameborder on the frame, the ownerDocument has a clientLeft of 2, so everything is shifted by 2px (for example, if you are at the position (0, 0) the pageX/pageY are -2/-2. I'm not sure why it is using this clientLeft property anyway, can anyone explain? \ → I ran into an issue in IE where the pageX and pageY were not being computed properly (that is, not consistent with native pageX/pageY calculations from other browsers). \ \ Test Case: http://jsfiddle.net/nfyVy/ \ \ Inside event.js, this small change seems to fix it: \ \ {{{ \ if (event.pageX == null && event.clientX != null) { \ var ownerDoc = event.target.ownerDocument || document; \ var doc = ownerDoc.documentElement, body = ownerDoc.body; \ }}} \ \ EXCEPT: \ When there is a frameborder on the frame, the ownerDocument has a clientLeft of 2, so everything is shifted by 2px (for example, if you are at the position (0, 0) the pageX/pageY are -2/-2. I'm not sure why it is using this clientLeft property anyway, can anyone explain? \ |
priority: | undecided → low |
status: | new → open |
Changed April 17, 2011 08:18PM UTC by comment:2
milestone: | → 1.next |
---|
Changed September 08, 2011 06:31PM UTC by comment:3
resolution: | → patchwelcome |
---|---|
status: | open → closed |
I can see the issue you describe in IE8. In general, cross-iframe issues are often hard to solve in older versions of IE. Since this ticket has been open a while it's unlikely we'll get to it soon. If someone can propose a simple patch that fixes the problem, please let us know by posting a message on the "Developing jQuery core" section of forums.jquery.com.