Fix for event fix: Don't overwrite event.target if there is no srcElement; calculate pageX/Y (tested with tooltip plugin)

This commit is contained in:
Jörn Zaefferer 2006-11-30 20:39:33 +00:00
parent c136717119
commit d98283a3a3

11
src/jquery/jquery.js vendored
View file

@ -1959,8 +1959,15 @@ 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) {