Side navigation
#1402 closed bug (fixed)
Opened July 16, 2007 10:59AM UTC
Closed July 20, 2007 07:00PM UTC
Last modified October 14, 2008 10:51AM UTC
Mouse Event Error in IE in 1.1.3.1
Reported by: | suv4x4 | Owned by: | brandon |
---|---|---|---|
Priority: | critical | Milestone: | 1.1.4 |
Component: | event | Version: | 1.1.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I was having a weird error with Ext UI for jscript 1.1.1 and I identified that the jquery coders tried to "object detect" integers like this:
... + (e.scrollLeft || b.scrollLeft);
Now.. that's very "smart" but fails every time e.scrollLeft is zero (in IE). Makes the code jump to b.scrollLeft and this ends with "Object expected" error.
I then downloaded 1.1.3.1 and noticed someone tried to fudge the issue by shuffling the code a bit (this is line 1442 from the uncompressed distribution):
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var e = document.documentElement, b = document.body;
event.pageX = event.clientX + (e && e.scrollLeft || b.scrollLeft);
event.pageY = event.clientY + (e && e.scrollTop || b.scrollTop);
}
Of course this accomplishes nothing and the issue still stands. Here's my fix (good ol' fashioned "typeof"):
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var e = document.documentElement, b = document.body;
if (typeof e.scrollLeft == 'undefined') {
event.pageX = event.clientX + b.scrollLeft;
event.pageY = event.clientY + b.scrollTop;
} else {
event.pageX = event.clientX + e.scrollLeft;
event.pageY = event.clientY + e.scrollTop;
}
}
Attachments (0)
Change History (4)
Changed July 16, 2007 11:00AM UTC by comment:1
Changed July 20, 2007 03:36PM UTC by comment:2
component: | ajax → event |
---|---|
summary: | Weird object detection → Mouse Event Error in IE in 1.1.3.1 |
The best fix that I've seen for this is:
e && e.scrollLeft || b && b.scrollLeft || 0
Changed July 20, 2007 03:36PM UTC by comment:3
owner: | → brandon |
---|
Changed July 20, 2007 07:00PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | new → closed |
Fixed in Rev [2419].
Nice, the comment system fudges the code.. well I could mail you the fix if you want, but the idea is using "typeof" variable == 'undefined' and not logical or.