Skip to content
Permalink
Browse files

Fix for event fix: Don't overwrite event.target if there is no srcEle…

…ment; calculate pageX/Y (tested with tooltip plugin)
  • Loading branch information
jzaefferer committed Nov 30, 2006
1 parent c136717 commit d98283a3a39b2fd4d2b0986c34c92f8c7b3c4e54
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/jquery/jquery.js
@@ -1959,9 +1959,16 @@ jQuery.extend({
fix: function(event) {
// check IE
if(jQuery.browser.msie) {
// fix target property
event.target = event.srcElement;

// fix target property, if available
// check prevents overwriting of fake target coming from trigger
if(event.srcElement)
event.target = event.srcElement;

// calculate pageX/Y
var e = document.documentElement, b = document.body;
event.pageX = event.clientX + (e.scrollLeft || b.scrollLeft);
event.pageY = event.clientY + (e.scrollTop || b.scrollTop);

// check safari and if target is a textnode
} else if(jQuery.browser.safari && event.target.nodeType == 3) {
// target is readonly, clone the event object
@@ -1980,7 +1987,7 @@ jQuery.extend({
event.stopPropagation = function() {
this.cancelBubble = true;
};

return event;
}
}

0 comments on commit d98283a

Please sign in to comment.
You can’t perform that action at this time.