MCPcopy Index your code
hub / github.com/JsAaron/jQuery / defaultDisplay

Function defaultDisplay

1.7/effects.js:636–678  ·  view source on GitHub ↗
( nodeName )

Source from the content-addressed store, hash-verified

634
635// Try to restore the default display value of an element
636function defaultDisplay( nodeName ) {
637
638 if ( !elemdisplay[ nodeName ] ) {
639
640 var body = document.body,
641 elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
642 display = elem.css( "display" );
643 elem.remove();
644
645 // If the simple way fails,
646 // get element's real default display by attaching it to a temp iframe
647 if ( display === "none" || display === "" ) {
648 // No iframe to use yet, so create it
649 if ( !iframe ) {
650 iframe = document.createElement( "iframe" );
651 iframe.frameBorder = iframe.width = iframe.height = 0;
652 }
653
654 body.appendChild( iframe );
655
656 // Create a cacheable copy of the iframe document on first call.
657 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
658 // document to it; WebKit & Firefox won't allow reusing the iframe document.
659 if ( !iframeDoc || !iframe.createElement ) {
660 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
661 iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
662 iframeDoc.close();
663 }
664
665 elem = iframeDoc.createElement( nodeName );
666
667 iframeDoc.body.appendChild( elem );
668
669 display = jQuery.css( elem, "display" );
670 body.removeChild( iframe );
671 }
672
673 // Store the correct default display
674 elemdisplay[ nodeName ] = display;
675 }
676
677 return elemdisplay[ nodeName ];
678}
679
680})( jQuery );

Callers 2

effects.jsFile · 0.70
doAnimationFunction · 0.70

Calls 1

jQueryFunction · 0.70

Tested by

no test coverage detected