MCPcopy
hub / github.com/jquery-backstretch/jquery-backstretch / css_defaultDisplay

Function css_defaultDisplay

libs/jquery/jquery.js:6992–7032  ·  view source on GitHub ↗
( nodeName )

Source from the content-addressed store, hash-verified

6990
6991// Try to determine the default display value of an element
6992function css_defaultDisplay( nodeName ) {
6993 if ( elemdisplay[ nodeName ] ) {
6994 return elemdisplay[ nodeName ];
6995 }
6996
6997 var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
6998 display = elem.css("display");
6999 elem.remove();
7000
7001 // If the simple way fails,
7002 // get element's real default display by attaching it to a temp iframe
7003 if ( display === "none" || display === "" ) {
7004 // Use the already-created iframe if possible
7005 iframe = document.body.appendChild(
7006 iframe || jQuery.extend( document.createElement("iframe"), {
7007 frameBorder: 0,
7008 width: 0,
7009 height: 0
7010 })
7011 );
7012
7013 // Create a cacheable copy of the iframe document on first call.
7014 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
7015 // document to it; WebKit & Firefox won't allow reusing the iframe document.
7016 if ( !iframeDoc || !iframe.createElement ) {
7017 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
7018 iframeDoc.write("<!doctype html><html><body>");
7019 iframeDoc.close();
7020 }
7021
7022 elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
7023
7024 display = curCSS( elem, "display" );
7025 document.body.removeChild( iframe );
7026 }
7027
7028 // Store the correct default display
7029 elemdisplay[ nodeName ] = display;
7030
7031 return display;
7032}
7033
7034jQuery.each([ "height", "width" ], function( i, name ) {
7035 jQuery.cssHooks[ name ] = {

Callers 2

showHideFunction · 0.85
defaultPrefilterFunction · 0.85

Calls 1

jQueryFunction · 0.85

Tested by

no test coverage detected