#7319 closed bug (patchwelcome)
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 (last modified by )
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?
Change History (3)
comment:1 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Description: | modified (diff) |
Priority: | undecided → low |
Status: | new → open |
comment:2 Changed 11 years ago by
Milestone: | → 1.next |
---|
comment:3 Changed 11 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | open → closed |
Note: See
TracTickets for help on using
tickets.
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.