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
21 // Called only from within defaultDisplay
22 function actualDisplay( name, doc ) {
23 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
25 display = jQuery.css( elem[ 0 ], "display" );
27 // We don't have any data stored on the element,
28 // so use "detach" method as fast way to get rid of the element
35 * Try to determine the default display value of an element
36 * @param {String} nodeName
38 function defaultDisplay( nodeName ) {
40 display = elemdisplay[ nodeName ];
43 display = actualDisplay( nodeName, doc );
45 // If the simple way fails, read from inside an iframe
46 if ( display === "none" || !display ) {
48 // Use the already-created iframe if possible
49 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ))
50 .appendTo( doc.documentElement );
52 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
53 doc = iframe[ 0 ].contentDocument;
59 display = actualDisplay( nodeName, doc );
63 // Store the correct default display
64 elemdisplay[ nodeName ] = display;
70 return defaultDisplay;