nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jquery / src / css / defaultDisplay.js
1 define( [
2         "../core",
3         "../var/document",
4         "../manipulation" // appendTo
5 ], function( jQuery, document ) {
6
7 var iframe,
8         elemdisplay = {
9
10                 // Support: Firefox
11                 // We have to pre-define these values for FF (#10227)
12                 HTML: "block",
13                 BODY: "block"
14         };
15
16 /**
17  * Retrieve the actual display of a element
18  * @param {String} name nodeName of the element
19  * @param {Object} doc Document object
20  */
21
22 // Called only from within defaultDisplay
23 function actualDisplay( name, doc ) {
24         var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
25
26                 display = jQuery.css( elem[ 0 ], "display" );
27
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
30         elem.detach();
31
32         return display;
33 }
34
35 /**
36  * Try to determine the default display value of an element
37  * @param {String} nodeName
38  */
39 function defaultDisplay( nodeName ) {
40         var doc = document,
41                 display = elemdisplay[ nodeName ];
42
43         if ( !display ) {
44                 display = actualDisplay( nodeName, doc );
45
46                 // If the simple way fails, read from inside an iframe
47                 if ( display === "none" || !display ) {
48
49                         // Use the already-created iframe if possible
50                         iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
51                                 .appendTo( doc.documentElement );
52
53                         // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
54                         doc = iframe[ 0 ].contentDocument;
55
56                         // Support: IE
57                         doc.write();
58                         doc.close();
59
60                         display = actualDisplay( nodeName, doc );
61                         iframe.detach();
62                 }
63
64                 // Store the correct default display
65                 elemdisplay[ nodeName ] = display;
66         }
67
68         return display;
69 }
70
71 return defaultDisplay;
72 } );