Tagging the 1.2.2b2 release.
[jquery.git] / src / fx.js
index b35dbcd..fb564f0 100644 (file)
--- a/src/fx.js
+++ b/src/fx.js
@@ -6,9 +6,12 @@ jQuery.fn.extend({
                        }, speed, callback) :
                        
                        this.filter(":hidden").each(function(){
-                               this.style.display = this.oldblock ? this.oldblock : "";
-                               if ( jQuery.css(this,"display") == "none" )
-                                       this.style.display = "block";
+                               this.style.display = this.oldblock || "";
+                               if ( jQuery.css(this,"display") == "none" ) {
+                                       var elem = jQuery("<" + this.tagName + " />").appendTo("body");
+                                       this.style.display = elem.css("display");
+                                       elem.remove();
+                               }
                        }).end();
        },
        
@@ -20,8 +23,6 @@ jQuery.fn.extend({
                        
                        this.filter(":visible").each(function(){
                                this.oldblock = this.oldblock || jQuery.css(this,"display");
-                               if ( this.oldblock == "none" )
-                                       this.oldblock = "block";
                                this.style.display = "none";
                        }).end();
        },
@@ -69,6 +70,9 @@ jQuery.fn.extend({
                var optall = jQuery.speed(speed, easing, callback);
 
                return this[ optall.queue === false ? "each" : "queue" ](function(){
+                       if ( this.nodeType != 1)
+                               return false;
+
                        var opt = jQuery.extend({}, optall);
                        var hidden = jQuery(this).is(":hidden"), self = this;
                        
@@ -135,6 +139,9 @@ jQuery.fn.extend({
                        return queue( this[0], type );
 
                return this.each(function(){
+                       if ( this.nodeType != 1)
+                               return;
+
                        if ( fn.constructor == Array )
                                queue(this, type, fn);
                        else {
@@ -174,7 +181,7 @@ jQuery.fn.extend({
 
 var queue = function( elem, type, array ) {
        if ( !elem )
-               return;
+               return undefined;
 
        type = type || "fx";