aboutsummaryrefslogtreecommitdiffstats
path: root/src/effects.js
diff options
context:
space:
mode:
authorrwldrn <waldron.rick@gmail.com>2011-04-12 11:48:07 -0400
committerrwldrn <waldron.rick@gmail.com>2011-04-12 11:48:07 -0400
commit7164615f6727c67da612fecc63867d30e1b4b4a3 (patch)
treed441adbb134c9517fd38e3bb3cb57b36452cce7b /src/effects.js
parentf19a74f10b82faf61e91a1408d0776d02511b28c (diff)
downloadjquery-7164615f6727c67da612fecc63867d30e1b4b4a3.tar.gz
jquery-7164615f6727c67da612fecc63867d30e1b4b4a3.zip
Ticket 8099, Reattempt with iframe
Diffstat (limited to 'src/effects.js')
-rw-r--r--src/effects.js31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/effects.js b/src/effects.js
index 7aec83009..73ce33a86 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -548,17 +548,42 @@ if ( jQuery.expr && jQuery.expr.filters ) {
}
function defaultDisplay( nodeName ) {
+ var stylesheets = document.styleSheets,
+ disabled = [],
+ elem, display, style, idx;
+
if ( !elemdisplay[ nodeName ] ) {
- var elem = jQuery("<" + nodeName + ">").appendTo("body"),
- display = elem.css("display");
+ // #8099 - If the end-dev has globally changed a default
+ // display, we can temporarily disable their styles to check
+ // for the correct default value
+ for ( idx = 0; idx < stylesheets.length; ++idx ) {
+ style = stylesheets[ idx ];
+ disabled[ idx ] = style.disabled;
+ style.disabled = true;
+ }
+
+ // To accurately check an element's default display value,
+ // create a temp element and check it's default display, this
+ // will ensure that the value returned is not a user-tampered
+ // value.
+ elem = jQuery("<" + nodeName + ">").appendTo("body"),
+ display = elem.css("display");
+
+ // Remove temp element
elem.remove();
if ( display === "none" || display === "" ) {
display = "block";
}
-
+
+ // Store the correct default display
elemdisplay[ nodeName ] = display;
+
+ // Restore stylesheets
+ for ( idx = 0; idx < stylesheets.length; ++idx ) {
+ stylesheets[ idx ].disabled = disabled[ idx ];
+ }
}
return elemdisplay[ nodeName ];