No reason to limit the initial change data store to just radio elements. Fixes #5851.
[jquery.git] / src / event.js
index 9873185..efefe57 100644 (file)
@@ -71,19 +71,28 @@ jQuery.event = {
                // Handle multiple events separated by a space
                // jQuery(...).bind("mouseover mouseout", fn);
                types = types.split( /\s+/ );
-               var type, i=0;
+
+               var type, i = 0;
+
                while ( (type = types[ i++ ]) ) {
                        // Namespaced event handlers
                        var namespaces = type.split(".");
                        type = namespaces.shift();
+
+                       if ( i > 1 ) {
+                               handler = jQuery.proxy( handler );
+
+                               if ( data !== undefined ) {
+                                       handler.data = data;
+                               }
+                       }
+
                        handler.type = namespaces.slice(0).sort().join(".");
 
                        // Get the current list of functions bound to this event
                        var handlers = events[ type ],
                                special = this.special[ type ] || {};
 
-                       
-
                        // Init the event handler queue
                        if ( !handlers ) {
                                handlers = events[ type ] = {};
@@ -105,6 +114,8 @@ jQuery.event = {
                                var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers ); 
                                if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { 
                                        modifiedHandler.guid = modifiedHandler.guid || handler.guid; 
+                                       modifiedHandler.data = modifiedHandler.data || handler.data; 
+                                       modifiedHandler.type = modifiedHandler.type || handler.type; 
                                        handler = modifiedHandler; 
                                } 
                        } 
@@ -717,10 +728,7 @@ jQuery.event.special.change = {
                // information/focus[in] is not needed anymore
                beforeactivate: function( e ) {
                        var elem = e.target;
-
-                       if ( elem.nodeName.toLowerCase() === "input" && elem.type === "radio" ) {
-                               jQuery.data( elem, "_change_data", getVal(elem) );
-                       }
+                       jQuery.data( elem, "_change_data", getVal(elem) );
                }
        },
        setup: function( data, namespaces, fn ) {