* Try to determine the default display value of an element * @param {String} nodeName
( nodeName )
| 35 | * @param {String} nodeName |
| 36 | */ |
| 37 | function defaultDisplay( nodeName ) { |
| 38 | var doc = document, |
| 39 | display = elemdisplay[ nodeName ]; |
| 40 | |
| 41 | if ( !display ) { |
| 42 | display = actualDisplay( nodeName, doc ); |
| 43 | |
| 44 | // If the simple way fails, read from inside an iframe |
| 45 | if ( display === "none" || !display ) { |
| 46 | |
| 47 | // Use the already-created iframe if possible |
| 48 | iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); |
| 49 | |
| 50 | // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse |
| 51 | doc = iframe[ 0 ].contentDocument; |
| 52 | |
| 53 | // Support: IE |
| 54 | doc.write(); |
| 55 | doc.close(); |
| 56 | |
| 57 | display = actualDisplay( nodeName, doc ); |
| 58 | iframe.detach(); |
| 59 | } |
| 60 | |
| 61 | // Store the correct default display |
| 62 | elemdisplay[ nodeName ] = display; |
| 63 | } |
| 64 | |
| 65 | return display; |
| 66 | } |
| 67 | |
| 68 | return defaultDisplay; |
| 69 |
no test coverage detected