]> source.dussan.org Git - jquery.git/commitdiff
Fix for event fix: Don't overwrite event.target if there is no srcElement; calculate...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 30 Nov 2006 20:39:33 +0000 (20:39 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 30 Nov 2006 20:39:33 +0000 (20:39 +0000)
src/jquery/jquery.js

index 689784a565539abea333816c923897e91aadd67a..4164f639087cfc6afab5190a8e01e90c35ed96f7 100644 (file)
@@ -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;
                }
        }