| 8513 | |
| 8514 | // Try to restore the default display value of an element |
| 8515 | function defaultDisplay( nodeName ) { |
| 8516 | |
| 8517 | if ( !elemdisplay[ nodeName ] ) { |
| 8518 | |
| 8519 | var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ), |
| 8520 | display = elem.css( "display" ); |
| 8521 | |
| 8522 | elem.remove(); |
| 8523 | |
| 8524 | // If the simple way fails, |
| 8525 | // get element's real default display by attaching it to a temp iframe |
| 8526 | if ( display === "none" || display === "" ) { |
| 8527 | // No iframe to use yet, so create it |
| 8528 | if ( !iframe ) { |
| 8529 | iframe = document.createElement( "iframe" ); |
| 8530 | iframe.frameBorder = iframe.width = iframe.height = 0; |
| 8531 | } |
| 8532 | |
| 8533 | document.body.appendChild( iframe ); |
| 8534 | |
| 8535 | // Create a cacheable copy of the iframe document on first call. |
| 8536 | // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html |
| 8537 | // document to it, Webkit & Firefox won't allow reusing the iframe document |
| 8538 | if ( !iframeDoc || !iframe.createElement ) { |
| 8539 | iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; |
| 8540 | iframeDoc.write( "<!doctype><html><body></body></html>" ); |
| 8541 | } |
| 8542 | |
| 8543 | elem = iframeDoc.createElement( nodeName ); |
| 8544 | |
| 8545 | iframeDoc.body.appendChild( elem ); |
| 8546 | |
| 8547 | display = jQuery.css( elem, "display" ); |
| 8548 | |
| 8549 | document.body.removeChild( iframe ); |
| 8550 | } |
| 8551 | |
| 8552 | // Store the correct default display |
| 8553 | elemdisplay[ nodeName ] = display; |
| 8554 | } |
| 8555 | |
| 8556 | return elemdisplay[ nodeName ]; |
| 8557 | } |
| 8558 | |
| 8559 | |
| 8560 | |