Fix for #921
[jquery.git] / src / jquery / jquery.js
index 3693ee3..c309428 100644 (file)
@@ -824,7 +824,9 @@ jQuery.fn = jQuery.prototype = {
         */
        clone: function(deep) {
                return this.pushStack( jQuery.map( this, function(a){
-                       return a.cloneNode( deep != undefined ? deep : true );
+                       var a = a.cloneNode( deep != undefined ? deep : true );
+                       a.$events = null; // drop $events expando to avoid firing incorrect events
+                       return a;
                }) );
        },
 
@@ -1280,7 +1282,7 @@ jQuery.extend({
        prop: function(elem, value, type, index, prop){
                        // Handle executable functions
                        if ( jQuery.isFunction( value ) )
-                               return value.call( elem, [index] );
+                               value = value.call( elem, [index] );
                                
                        // exclude the following css properties to add px
                        var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
@@ -1470,7 +1472,7 @@ jQuery.extend({
                        if ( arg.length === 0 )
                                return;
                        
-                       if ( arg[0] == undefined || (jQuery.browser.msie && jQuery.nodeName(arg,"form")) )
+                       if ( arg[0] == undefined )
                                r.push( arg );
                        else
                                r = jQuery.merge( r, arg );
@@ -1495,8 +1497,6 @@ jQuery.extend({
                        selected: "selected"
                };
                
-               var fixIE = jQuery.isXMLDoc(elem) ? [] : "href,src,background,cite,classid,codebase,data,longdesc,profile,usemap".split(',');
-               
                // IE actually uses filters for opacity ... elem is actually elem.style
                if ( name == "opacity" && jQuery.browser.msie && value != undefined ) {
                        // IE has trouble with opacity if it does not have layout
@@ -1527,7 +1527,8 @@ jQuery.extend({
                // IE elem.getAttribute passes even for style
                else if ( elem.tagName ) {
                        if ( value != undefined ) elem.setAttribute( name, value );
-                       if ( jQuery.browser.msie && fixIE[name] ) return elem.getAttribute( name, 2 );
+                       if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) 
+                               return elem.getAttribute( name, 2 );
                        return elem.getAttribute( name );
 
                // elem is actually elem.style ... set the style