From d98283a3a39b2fd4d2b0986c34c92f8c7b3c4e54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Thu, 30 Nov 2006 20:39:33 +0000 Subject: [PATCH] Fix for event fix: Don't overwrite event.target if there is no srcElement; calculate pageX/Y (tested with tooltip plugin) --- src/jquery/jquery.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 689784a56..4164f6390 100644 --- a/src/jquery/jquery.js +++ b/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; } } -- 2.39.5