diff options
Diffstat (limited to 'src/css.js')
-rw-r--r-- | src/css.js | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/css.js b/src/css.js index c9a1ab433..5df4f7efd 100644 --- a/src/css.js +++ b/src/css.js @@ -443,17 +443,13 @@ function getWidthOrHeight( elem, name, extra ) { ) + "px"; } - // Try to determine the default display value of an element function css_defaultDisplay( nodeName ) { - var elem, - doc = document, + var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { - elem = jQuery( doc.createElement( nodeName ) ); - display = curCSS( elem.appendTo( doc.body )[0], "display" ); - elem.remove(); + display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { @@ -468,9 +464,7 @@ function css_defaultDisplay( nodeName ) { doc.write("<!doctype html><html><body>"); doc.close(); - elem = jQuery( doc.createElement( nodeName ) ); - display = curCSS( elem.appendTo( doc.body )[0], "display" ); - elem.remove(); + display = actualDisplay( nodeName, doc ); iframe.detach(); } @@ -481,6 +475,15 @@ function css_defaultDisplay( nodeName ) { return display; } +// Called ONLY from within css_defaultDisplay +function actualDisplay( name, doc ) { + var elem, display; + elem = jQuery( doc.createElement( name ) ); + display = curCSS( elem.appendTo( doc.body )[0], "display" ); + elem.remove(); + return display; +} + jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { @@ -541,7 +544,7 @@ if ( !jQuery.support.opacity ) { // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 // if value === "", then remove inline opacity #12685 if ( ( value >= 1 || value === "" ) && - jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + jQuery.trim( filter.replace( ralpha, "" ) ) === "" && style.removeAttribute ) { // Setting style.filter to null, "" & " " still leave "filter:" in the cssText |