Side navigation
#451 closed bug (fixed)
Opened November 29, 2006 02:26PM UTC
Closed November 30, 2006 09:16PM UTC
Last modified June 20, 2007 01:27AM UTC
IE Bug (under Win2000) concerning event
Reported by: | probert.dave@gmail.c | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | event | Version: | 1.1a |
Keywords: | explorer bug | Cc: | |
Blocked by: | Blocking: |
Description
In the 'event: {}' section (about line 1000 of jquery.js) in the 'fix' function, IE was throwing JS errors with:
event.target = event.srcElement;
complaining that event was "null or not an object"!!
As a workaround I prefixed all event bits in here with "if(event)" - this seemed to work and stoped IE falling over. Firefox (as usual) works perfectly either way.
Here is a copy of the changed code - this could do with a lot better handling than this, but I'll leave that to the experts.
fix: function(event) {
check IE
if(jQuery.browser.msie) {
get real event from window.event
event = window.event;
fix target property
if(event)
event.target = event.srcElement;
check safari and if target is a textnode
} else if(jQuery.browser.safari && event.target.nodeType == 3) {
target is readonly, clone the event object
event = jQuery.extend({}, event);
get parentnode from textnode
if(event)
event.target = event.target.parentNode;
}
// fix preventDefault and stopPropagation
if(event)
{
event.preventDefault = function() {
this.returnValue = false;
};
event.stopPropagation = function() {
this.cancelBubble = true;
};
}
return event;
}
Attachments (0)
Change History (3)
Changed November 29, 2006 08:36PM UTC by comment:1
resolution: | → fixed |
---|---|
status: | new → closed |
Changed November 30, 2006 06:29AM UTC by comment:2
resolution: | fixed |
---|---|
status: | closed → reopened |
Sorry, the latest version is what I am using (tested again with a new download 2 minutes ago!).
The MS Script Debugger is popping up during an Ajax call, on the line 1015:
event.target = event.srcElement;
I have no idea where in the library a trigger event is being called. My code does not use trigger.
The only 'Fix' I have apart from altering jQuery.js is to stick an alert() after the ajax call!!! then everything seems ok. But this is not ideal or a solution.
I am using only 'out-of-the-box' jQuery.js and it is definately being set off by the $.ajax() call.
Sorry for the bad news.
Changed November 30, 2006 09:16PM UTC by comment:3
resolution: | → fixed |
---|---|
status: | reopened → closed |
Fixed in SVN. There is now a check if the srcElement exists. Please test it again with the latest revision. If the fix doesn't help, please try to modify this:
if(event.srcElement)
to
if(!event.target && event.srcElement)
Please update to the latest revision, the problems you describe are already fixed there. It occured when no event object was present, which was the case when using trigger().