Side navigation
#1322 closed bug (fixed)
Opened June 26, 2007 09:14AM UTC
Closed June 29, 2007 10:20PM UTC
event.pageX/Y fails with page scrolls in IE quirks mode
| Reported by: | arrix | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.1.3 |
| Component: | event | Version: | 1.1.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
IE is notorious for its inconsistent rendering mode. In standard-compliant mode, document.documentElement.scrollLeft/Top tell the actual page scroll offsets. But in quirks mode, document.body.scrollLeft/Top tell the truth and document.documentElement.scrollLeft/Top is always 0.
Tested with IE7 Windows Server 2003 R2 SP2.
A possible fix
Index: E:/zm/jquery/jquery/src/event/event.js
===================================================================
--- E:/zm/jquery/jquery/src/event/event.js (revision 2158)
+++ E:/zm/jquery/jquery/src/event/event.js (working copy)
@@ -226,9 +226,9 @@
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
- var e = document.documentElement || document.body;
- event.pageX = event.clientX + e.scrollLeft;
- event.pageY = event.clientY + e.scrollTop;
+ var e = document.documentElement, b = document.body;
+ event.pageX = event.clientX + (e && e.scrollLeft || b && b.scrollLeft);
+ event.pageY = event.clientY + (e && e.scrollTop || b && b.scrollTop);
}
// Add which for key events
Attachments (0)
Change History (1)
Changed June 29, 2007 10:20PM UTC by comment:1
| resolution: | → fixed |
|---|---|
| status: | new → closed |
Fixed in Rev [2193].