jquery selector: closes #3023. The attribute filter accepts ':'.
[jquery.git] / src / event.js
index 3870f43..8529d13 100644 (file)
@@ -66,7 +66,7 @@ jQuery.event = {
                                // Check for a special event handler
                                // Only use addEventListener/attachEvent if the special
                                // events handler returns false
-                               if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
+                               if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem,data) === false ) {
                                        // Bind the global event handler to the element
                                        if (elem.addEventListener)
                                                elem.addEventListener(type, handle, false);
@@ -168,7 +168,10 @@ jQuery.event = {
                if ( !elem ) {
                        // Only trigger if we've ever bound an event for it
                        if ( this.global[type] )
-                               jQuery("*").add([window, document]).trigger(type, data);
+                               jQuery.each( jQuery.cache, function(){
+                                       if ( this.events && this.events[type] )
+                                               jQuery.event.trigger( type, data, this.handle.elem );
+                               });
 
                // Handle triggering a single element
                } else {
@@ -367,9 +370,9 @@ jQuery.event = {
                },
 
                mouseenter: {
-                       setup: function() {
+                       setup: function( data ) {
                                if ( jQuery.browser.msie ) return false;
-                               jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
+                               jQuery(this).bind("mouseover", data, jQuery.event.special.mouseenter.handler);
                                return true;
                        },
 
@@ -389,9 +392,9 @@ jQuery.event = {
                },
 
                mouseleave: {
-                       setup: function() {
+                       setup: function( data ) {
                                if ( jQuery.browser.msie ) return false;
-                               jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
+                               jQuery(this).bind("mouseout", data, jQuery.event.special.mouseleave.handler);
                                return true;
                        },
 
@@ -600,6 +603,9 @@ var withinElement = function(event, elem) {
 // Prevent memory leaks in IE
 // And prevent errors on refresh with events like mouseover in other browsers
 // Window isn't included so as not to unbind existing unload events
-jQuery(window).bind("unload", function() {
-       jQuery("*").add(document).unbind();
-});
+jQuery( window ).bind( 'unload', function(){ 
+       for ( var id in jQuery.cache )
+               // Skip the window
+               if ( id != 1 && jQuery.cache[ id ].handle )
+                       jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+});