4 "../manipulation" // appendTo
5 ], function( jQuery, document ) {
11 // We have to pre-define these values for FF (#10227)
17 * Retrieve the actual display of a element
18 * @param {String} name nodeName of the element
19 * @param {Object} doc Document object
22 // Called only from within defaultDisplay
23 function actualDisplay( name, doc ) {
24 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
26 display = jQuery.css( elem[ 0 ], "display" );
28 // We don't have any data stored on the element,
29 // so use "detach" method as fast way to get rid of the element
36 * Try to determine the default display value of an element
37 * @param {String} nodeName
39 function defaultDisplay( nodeName ) {
41 display = elemdisplay[ nodeName ];
44 display = actualDisplay( nodeName, doc );
46 // If the simple way fails, read from inside an iframe
47 if ( display === "none" || !display ) {
49 // Use the already-created iframe if possible
50 iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
51 .appendTo( doc.documentElement );
53 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
54 doc = iframe[ 0 ].contentDocument;
60 display = actualDisplay( nodeName, doc );
64 // Store the correct default display
65 elemdisplay[ nodeName ] = display;
71 return defaultDisplay;