> 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.
>
Hi Adam,
interesting, I was talking about normalizing the target property quite
recently as well.
I also think that e.target should be fixed. But I wouldn't use a new
variable targ for that, instead simply attach target to e in IE:
if (e.srcElement) e.target = e.srcElement;
First I wasn't sure if that would break existing scripts that rely on
the as-is state. But as most scripts go like this:
var evTarget = e.target || e.srcElement;
that would still work out fine.
John or Jörn, shouldn't that be added to the event fix? And maybe the
two or three other properties that are different from each other?
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/