]> source.dussan.org Git - jquery.git/commitdiff
Fix a failing effects test in IE; minor style changes in effects
authortimmywil <timmywillisn@gmail.com>
Tue, 1 Nov 2011 13:46:20 +0000 (09:46 -0400)
committertimmywil <timmywillisn@gmail.com>
Tue, 1 Nov 2011 13:46:20 +0000 (09:46 -0400)
src/css.js
src/effects.js

index ea1037ded516500984bb583e722d583d785f451d..3e14e1be3be15354a781fb9da55672906ca79afe 100644 (file)
@@ -285,12 +285,14 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
 
 if ( document.documentElement.currentStyle ) {
        currentStyle = function( elem, name ) {
-               var left, rsLeft,
+               var left, rsLeft, uncomputed,
                        ret = elem.currentStyle && elem.currentStyle[ name ],
                        style = elem.style;
 
-               if ( ret === null && style ) {
-                       ret = style[ name ];
+               // Avoid setting ret to empty string here
+               // so we don't default to auto
+               if ( ret === null && style && (uncomputed = style[ name ]) ) {
+                       ret = uncomputed;
                }
 
                // From the awesome hack by Dean Edwards
index 67c0c0893771d09e21c8cca0ae34b55952b4f950..523cd7d29da063f5e8c7d61f0a558a0e1b623ea8 100644 (file)
@@ -20,11 +20,11 @@ jQuery.fn.extend({
                var elem, display;
 
                if ( speed || speed === 0 ) {
-                       return this.animate( genFx("show", 3), speed, easing, callback);
+                       return this.animate( genFx("show", 3), speed, easing, callback );
 
                } else {
                        for ( var i = 0, j = this.length; i < j; i++ ) {
-                               elem = this[i];
+                               elem = this[ i ];
 
                                if ( elem.style ) {
                                        display = elem.style.display;
@@ -38,8 +38,8 @@ jQuery.fn.extend({
                                        // Set elements which have been overridden with display: none
                                        // in a stylesheet to whatever the default browser style is
                                        // for such an element
-                                       if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
-                                               jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
+                                       if ( display === "" && jQuery.css(elem, "display") === "none" ) {
+                                               jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
                                        }
                                }
                        }
@@ -47,13 +47,13 @@ jQuery.fn.extend({
                        // Set the display of most of the elements in a second loop
                        // to avoid the constant reflow
                        for ( i = 0; i < j; i++ ) {
-                               elem = this[i];
+                               elem = this[ i ];
 
                                if ( elem.style ) {
                                        display = elem.style.display;
 
                                        if ( display === "" || display === "none" ) {
-                                               elem.style.display = jQuery._data(elem, "olddisplay") || "";
+                                               elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
                                        }
                                }
                        }
@@ -67,12 +67,17 @@ jQuery.fn.extend({
                        return this.animate( genFx("hide", 3), speed, easing, callback);
 
                } else {
-                       for ( var i = 0, j = this.length; i < j; i++ ) {
-                               if ( this[i].style ) {
-                                       var display = jQuery.css( this[i], "display" );
+                       var elem, display,
+                               i = 0,
+                               j = this.length;
 
-                                       if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
-                                               jQuery._data( this[i], "olddisplay", display );
+                       for ( ; i < j; i++ ) {
+                               elem = this[i];
+                               if ( elem.style ) {
+                                       display = jQuery.css( elem, "display" );
+
+                                       if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
+                                               jQuery._data( elem, "olddisplay", display );
                                        }
                                }
                        }
@@ -635,7 +640,6 @@ function defaultDisplay( nodeName ) {
                var body = document.body,
                        elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
                        display = elem.css( "display" );
-
                elem.remove();
 
                // If the simple way fails,
@@ -663,7 +667,6 @@ function defaultDisplay( nodeName ) {
                        iframeDoc.body.appendChild( elem );
 
                        display = jQuery.css( elem, "display" );
-
                        body.removeChild( iframe );
                }