jquery event: closes #4033. e.currentTarget wasn't being enforced for native events...
[jquery.git] / src / event.js
index 5ae4bad..a50fe89 100644 (file)
@@ -240,7 +240,8 @@ jQuery.event = {
                var all, handlers;
 
                event = arguments[0] = jQuery.event.fix( event || window.event );
-
+               event.currentTarget = this;
+               
                // Namespaced event handlers
                var namespaces = event.type.split(".");
                event.type = namespaces.shift();
@@ -571,10 +572,13 @@ function liveHandler( event ){
                }
        });
 
+       elems.sort(function(a,b) {
+               return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
+       });
+       
        jQuery.each(elems, function(){
-               if ( !event.isImmediatePropagationStopped() &&
-                       this.fn.call(this.elem, event, this.fn.data) === false )
-                               stop = false;
+               if ( this.fn.call(this.elem, event, this.fn.data) === false )
+                       return (stop = false);
        });
 
        return stop;
@@ -638,7 +642,7 @@ function bindReady(){
 
                // If IE and not an iframe
                // continually check to see if the document is ready
-               if ( document.documentElement.doScroll && typeof window.frameElement === "undefined" ) (function(){
+               if ( document.documentElement.doScroll && window == window.top ) (function(){
                        if ( jQuery.isReady ) return;
 
                        try {