Ticket #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: | ||
| Blocking: | Blocked by: |
Description (last modified by rwaldron) (diff)
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
comment:1 Changed 3 years ago by rwaldron
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to event
- Description modified (diff)
comment:3 Changed 21 months ago by dmethvin
- Status changed from open to closed
- Resolution set to patchwelcome
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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
