Restrict the attr quick setters to only methods that specifically ask for the functio...
[jquery.git] / src / event.js
index ac45e7e..a32f033 100644 (file)
@@ -253,8 +253,10 @@ jQuery.event = {
 
                var nativeFn, nativeHandler;
                try {
-                       nativeFn = elem[ type ];
-                       nativeHandler = elem[ "on" + type ];
+                       if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
+                               nativeFn = elem[ type ];
+                               nativeHandler = elem[ "on" + type ];
+                       }
                // prevent IE from throwing an error for some elements with some event types, see #3533
                } catch (e) {}
 
@@ -872,9 +874,7 @@ function liveHandler( event ) {
 }
 
 function liveConvert( type, selector ) {
-       return ["live", type, selector//.replace(/[^\w\s\.]/g, function(ch){ return "\\"+ch})
-                                                                 .replace(/\./g, "`")
-                                                                 .replace(/ /g, "|")].join(".");
+       return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "&")].join(".");
 }
 
 jQuery.each( ("blur focus load resize scroll unload click dblclick " +
@@ -885,6 +885,10 @@ jQuery.each( ("blur focus load resize scroll unload click dblclick " +
        jQuery.fn[ name ] = function( fn ) {
                return fn ? this.bind( name, fn ) : this.trigger( name );
        };
+
+       if ( jQuery.fnAttr ) {
+               jQuery.fnAttr[ name ] = true;
+       }
 });
 
 // Prevent memory leaks in IE
@@ -896,7 +900,10 @@ 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 );
+                       // Try/Catch is to handle iframes being unloaded, see #4280
+                       try {
+                               jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+                       } catch(e) {}
                }
        }
 });