|
define( [ |
|
"../core", |
|
"../var/document", |
|
"../manipulation" |
|
], function( jQuery, document ) { |
|
|
|
var iframe, |
|
elemdisplay = { |
|
|
|
|
|
|
|
HTML: "block", |
|
BODY: "block" |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function actualDisplay( name, doc ) { |
|
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), |
|
|
|
display = jQuery.css( elem[ 0 ], "display" ); |
|
|
|
|
|
|
|
elem.detach(); |
|
|
|
return display; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
function defaultDisplay( nodeName ) { |
|
var doc = document, |
|
display = elemdisplay[ nodeName ]; |
|
|
|
if ( !display ) { |
|
display = actualDisplay( nodeName, doc ); |
|
|
|
|
|
if ( display === "none" || !display ) { |
|
|
|
|
|
iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) ) |
|
.appendTo( doc.documentElement ); |
|
|
|
|
|
doc = iframe[ 0 ].contentDocument; |
|
|
|
|
|
doc.write(); |
|
doc.close(); |
|
|
|
display = actualDisplay( nodeName, doc ); |
|
iframe.detach(); |
|
} |
|
|
|
|
|
elemdisplay[ nodeName ] = display; |
|
} |
|
|
|
return display; |
|
} |
|
|
|
return defaultDisplay; |
|
} ); |
|
|