Rewrote the hide and show methods to fix the issue with Safari not hiding distached...
[jquery.git] / src / core.js
index c625d85..18069bc 100644 (file)
@@ -482,7 +482,7 @@ jQuery.fn = jQuery.prototype = {
                        if ( data === undefined && this.length )
                                data = jQuery.data( this[0], key );
 
-                       return data === undefined && parts[1] ?
+                       return data == null && parts[1] ?
                                this.data( parts[0] ) :
                                data;
                } else
@@ -501,11 +501,12 @@ jQuery.fn = jQuery.prototype = {
                if ( this[0] ) {
                        var fragment = document.createDocumentFragment(),
                                scripts = jQuery.clean( args, this[0].ownerDocument, fragment ),
-                               first = fragment.firstChild;
+                               first = fragment.firstChild,
+                               extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
                        
                        if ( first )
                                for ( var i = 0, l = this.length; i < l; i++ )
-                                       callback.call( root(this[i], first), this.length > 1 ? fragment.cloneNode(true) : fragment );
+                                       callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );
                        
                        if ( scripts )
                                jQuery.each( scripts, evalScript );