Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#451 closed bug (fixed)

IE Bug (under Win2000) concerning event

Reported by: probert.dave@… 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; }

Change History (3)

comment:1 Changed 12 years ago by joern

Resolution: fixed
Status: newclosed

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().

comment:2 Changed 12 years ago by probert.dave

Resolution: fixed
Status: closedreopened

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.

comment:3 Changed 12 years ago by joern

Resolution: fixed
Status: reopenedclosed

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)
Note: See TracTickets for help on using tickets.