( nodeName )
| 9013 | |
| 9014 | // Try to restore the default display value of an element |
| 9015 | function defaultDisplay( nodeName ) { |
| 9016 | |
| 9017 | if ( !elemdisplay[ nodeName ] ) { |
| 9018 | |
| 9019 | var body = document.body, |
| 9020 | elem = jQuery( "<" + nodeName + ">" ).appendTo( body ), |
| 9021 | display = elem.css( "display" ); |
| 9022 | elem.remove(); |
| 9023 | |
| 9024 | // If the simple way fails, |
| 9025 | // get element's real default display by attaching it to a temp iframe |
| 9026 | if ( display === "none" || display === "" ) { |
| 9027 | // No iframe to use yet, so create it |
| 9028 | if ( !iframe ) { |
| 9029 | iframe = document.createElement( "iframe" ); |
| 9030 | iframe.frameBorder = iframe.width = iframe.height = 0; |
| 9031 | } |
| 9032 | |
| 9033 | body.appendChild( iframe ); |
| 9034 | |
| 9035 | // Create a cacheable copy of the iframe document on first call. |
| 9036 | // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML |
| 9037 | // document to it; WebKit & Firefox won't allow reusing the iframe document. |
| 9038 | if ( !iframeDoc || !iframe.createElement ) { |
| 9039 | iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; |
| 9040 | iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" ); |
| 9041 | iframeDoc.close(); |
| 9042 | } |
| 9043 | |
| 9044 | elem = iframeDoc.createElement( nodeName ); |
| 9045 | |
| 9046 | iframeDoc.body.appendChild( elem ); |
| 9047 | |
| 9048 | display = jQuery.css( elem, "display" ); |
| 9049 | body.removeChild( iframe ); |
| 9050 | } |
| 9051 | |
| 9052 | // Store the correct default display |
| 9053 | elemdisplay[ nodeName ] = display; |
| 9054 | } |
| 9055 | |
| 9056 | return elemdisplay[ nodeName ]; |
| 9057 | } |
| 9058 | |
| 9059 | |
| 9060 |
no test coverage detected