diff options
author | rwldrn <waldron.rick@gmail.com> | 2011-01-31 14:31:15 -0500 |
---|---|---|
committer | rwldrn <waldron.rick@gmail.com> | 2011-01-31 14:31:15 -0500 |
commit | 0d2e4796dc97d3f9d6b5c1977e883b3ddf2f53d9 (patch) | |
tree | efaabbe7191fd9b50d369a4592c1c3ec12352788 /src/effects.js | |
parent | e0b1bb8e3d66db4166ac7ee2146903bae7ab1eb9 (diff) | |
download | jquery-0d2e4796dc97d3f9d6b5c1977e883b3ddf2f53d9.tar.gz jquery-0d2e4796dc97d3f9d6b5c1977e883b3ddf2f53d9.zip |
Bug #8099 - Always restore to correct display value based on element's expected default display
Diffstat (limited to 'src/effects.js')
-rw-r--r-- | src/effects.js | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/effects.js b/src/effects.js index b0675395f..c73fd929e 100644 --- a/src/effects.js +++ b/src/effects.js @@ -505,17 +505,38 @@ if ( jQuery.expr && jQuery.expr.filters ) { } function defaultDisplay( nodeName ) { + var stylesheets = document.styleSheets, + disabled = [], + elem, display; + 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 + jQuery.each( stylesheets, function( idx, obj ) { + disabled[ idx ] = obj.disabled; + obj.disabled = true; + }); + + // Create a temp element and check it's default display + 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 + jQuery.each( stylesheets, function( idx, obj ) { + this.disabled = disabled[ idx ]; + }); } return elemdisplay[ nodeName ]; |