]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/jquery/src/css/defaultDisplay.js
046ae91b9128f95f2f40cc0e9c81ce99da0d3f25
3 "../manipulation" // appendTo
4 ], function( jQuery
) {
10 * Retrieve the actual display of a element
11 * @param {String} name nodeName of the element
12 * @param {Object} doc Document object
14 // Called only from within defaultDisplay
15 function actualDisplay( name
, doc
) {
17 elem
= jQuery( doc
.createElement( name
) ).appendTo( doc
.body
),
19 // getDefaultComputedStyle might be reliably used only on attached element
20 display
= window
.getDefaultComputedStyle
&& ( style
= window
.getDefaultComputedStyle( elem
[ 0 ] ) ) ?
22 // Use of this method is a temporary fix (more like optimization) until something better comes along,
23 // since it was removed from specification and supported only in FF
24 style
.display : jQuery
.css( elem
[ 0 ], "display" );
26 // We don't have any data stored on the element,
27 // so use "detach" method as fast way to get rid of the element
34 * Try to determine the default display value of an element
35 * @param {String} nodeName
37 function defaultDisplay( nodeName
) {
39 display
= elemdisplay
[ nodeName
];
42 display
= actualDisplay( nodeName
, doc
);
44 // If the simple way fails, read from inside an iframe
45 if ( display
=== "none" || !display
) {
47 // Use the already-created iframe if possible
48 iframe
= (iframe
|| jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc
.documentElement
);
50 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
51 doc
= iframe
[ 0 ].contentDocument
;
57 display
= actualDisplay( nodeName
, doc
);
61 // Store the correct default display
62 elemdisplay
[ nodeName
] = display
;
68 return defaultDisplay
;