function defaultDisplay( nodeName ) {

  if ( !elemdisplay[ nodeName ] ) {

    var body = document.body,
      elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
      display = elem.css( "display" );

    elem.remove();

    // If the simple way fails,
    // get element's real default display by attaching it to a temp iframe
    if ( display === "none" || display === "" ) {
      // No iframe to use yet, so create it
      if ( !iframe ) {
        iframe = document.createElement( "iframe" );
        iframe.frameBorder = iframe.width = iframe.height = 0;
      }

      body.appendChild( iframe );

      // Create a cacheable copy of the iframe document on first call.
      // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
      // document to it; WebKit & Firefox won't allow reusing the iframe document.
      if ( !iframeDoc || !iframe.createElement ) {
        iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
        iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
        iframeDoc.close();
      }

      elem = iframeDoc.createElement( nodeName );

      iframeDoc.body.appendChild( elem );

      display = jQuery.css( elem, "display" );

      body.removeChild( iframe );
    }

    // Store the correct default display
    elemdisplay[ nodeName ] = display;
  }

  return elemdisplay[ nodeName ];
}
// Try to restore the default display value of an element
Try to restore the default display value of an element
Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
  if ( !elemdisplay[ nodeName ] ) {
    var body = document.body,
      elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
      display = elem.css( "display" );
    elem.remove();
    if ( display === "none" || display === "" ) {
      if ( !iframe ) {
        iframe = document.createElement( "iframe" );
        iframe.frameBorder = iframe.width = iframe.height = 0;
      }
      body.appendChild( iframe );
      if ( !iframeDoc || !iframe.createElement ) {
        iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
        iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
        iframeDoc.close();
      }
      elem = iframeDoc.createElement( nodeName );
      iframeDoc.body.appendChild( elem );
      display = jQuery.css( elem, "display" );
      body.removeChild( iframe );
    }
    elemdisplay[ nodeName ] = display;
  }
  return elemdisplay[ nodeName ];
}
function defaultDisplay ( nodeName ) { if ( ! elemdisplay [ nodeName ] ) { var body = document . body , elem = jQuery ( "<" + nodeName + ">" ) . appendTo ( body ) , display = elem . css ( "display" ) ; elem . remove ( ) ; if ( display === "none" || display === "" ) { if ( ! iframe ) { iframe = document . createElement ( "iframe" ) ; iframe . frameBorder = iframe . width = iframe . height = 0 ; } body . appendChild ( iframe ) ; if ( ! iframeDoc || ! iframe . createElement ) { iframeDoc = ( iframe . contentWindow || iframe . contentDocument ) . document ; iframeDoc . write ( ( document . compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" ) ; iframeDoc . close ( ) ; } elem = iframeDoc . createElement ( nodeName ) ; iframeDoc . body . appendChild ( elem ) ; display = jQuery . css ( elem , "display" ) ; body . removeChild ( iframe ) ; } elemdisplay [ nodeName ] = display ; } return elemdisplay [ nodeName ] ; }
Try to restore the default display value of an element
Try to restore the default display value of an element
// If the simple way fails, // get element's real default display by attaching it to a temp iframe // No iframe to use yet, so create it // Create a cacheable copy of the iframe document on first call. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML // document to it; WebKit & Firefox won't allow reusing the iframe document. // Store the correct default display