MCPcopy Create free account
hub / github.com/F-Stack/f-stack / defaultDisplay

Function defaultDisplay

tools/libxo/xohtml/external/jquery.js:8906–8948  ·  view source on GitHub ↗
( nodeName )

Source from the content-addressed store, hash-verified

8904
8905// Try to restore the default display value of an element
8906function defaultDisplay( nodeName ) {
8907
8908 if ( !elemdisplay[ nodeName ] ) {
8909
8910 var body = document.body,
8911 elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
8912 display = elem.css( "display" );
8913 elem.remove();
8914
8915 // If the simple way fails,
8916 // get element's real default display by attaching it to a temp iframe
8917 if ( display === "none" || display === "" ) {
8918 // No iframe to use yet, so create it
8919 if ( !iframe ) {
8920 iframe = document.createElement( "iframe" );
8921 iframe.frameBorder = iframe.width = iframe.height = 0;
8922 }
8923
8924 body.appendChild( iframe );
8925
8926 // Create a cacheable copy of the iframe document on first call.
8927 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
8928 // document to it; WebKit & Firefox won't allow reusing the iframe document.
8929 if ( !iframeDoc || !iframe.createElement ) {
8930 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
8931 iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
8932 iframeDoc.close();
8933 }
8934
8935 elem = iframeDoc.createElement( nodeName );
8936
8937 iframeDoc.body.appendChild( elem );
8938
8939 display = jQuery.css( elem, "display" );
8940 body.removeChild( iframe );
8941 }
8942
8943 // Store the correct default display
8944 elemdisplay[ nodeName ] = display;
8945 }
8946
8947 return elemdisplay[ nodeName ];
8948}
8949
8950
8951

Callers 2

jquery.jsFile · 0.85
doAnimationFunction · 0.85

Calls 3

jQueryFunction · 0.85
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected