I was working with the event model and I noticed that while some steps are taken to "fix" the IE event object some of the cross browser inconsistancies, it doesn't fix all of them. It doesn't even fix the most annoying inconsistancies, namely the target and/or srcElement is not unified. Is there any reason for this?
I was nosing around PPK's quirksmode site, as I frequently do, and I realized that some of his event stuff could be integrated into jQuery (taken from a snippet of jQuery code): handle: function(event) { if ( typeof jQuery == "undefined" ) return; event = jQuery.event.fix( event || window.event ); // If no correct event was found, fail if ( !event ) return; var returnValue = true; var c = this.events[event.type]; var args = [].slice.call( arguments, 1 ); args.unshift( event ); for ( var j in c ) { if ( c[j].apply( this, args ) === false ) { event.preventDefault(); event.stopPropagation(); returnValue = false; } } return returnValue; }, fix: function(event) { if ( event ) { if( !event.preventDefault ) { event.preventDefault = function() { this.returnValue = false; }; } if( !event.stopPropagation ) { event.stopPropagation = function() { this.cancelBubble = true; }; } /*Taken from PPK: http://www.quirksmode.org/js/events_properties.html */ var targ; if (event.target) { targ = event.target; } else if( event.srcElement ) { targ = event.srcElement; } if (targ.nodeType == 3) { // defeat Safari bug targ = targ.parentNode; } event.realTarget = targ; } return event; } Now, I haven't actually tested this so there's bound to be a bug somewhere in that code but you get the general idea. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/