Permalink
Browse files

Rewriting patch accordingly to timmywil suggestion (http://bugs.jquer…

  • Loading branch information...
1 parent 8daafbf commit b6d07fa505f1ae504cdfcee9dc78b3880e6c1a67 @markelog committed Aug 12, 2011
Showing with 9 additions and 12 deletions.
  1. +9 −12 src/effects.js
View
@@ -39,19 +39,16 @@ 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
- // For documentFragment, Mozilla will get real css value.
- // Opera, Chrome and Safari will get empty string
- // IE will get default display
- if ( display === "" && (computedDisplay = jQuery.css( elem, "display" ), computedDisplay === "none" || computedDisplay == "") ) {
+ // in a stylesheet or not attach to document
+ // to whatever the default browser style is for such an element.
+ // Special check for IE, if node is not attached to document
+ // currentStyle always return default display
+ if( display === "" && elem.sourceIndex === 0 ) {
+ jQuery._data(elem, "olddisplay", jQuery.css( elem, "display" ));
+
+ // Check for all other browsers
+ } else if ( display === "" && jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
-
- // In IE, sourceIndex === 0 means either documentFragment or html element
- // for documentFragment it already will be default display
- } else if ( elem.sourceIndex === 0 ) {
- jQuery._data(elem, "olddisplay", computedDisplay);
-
}
}
}

0 comments on commit b6d07fa

Please sign in to comment.