if ( !elemdisplay[ nodeName ] ) {
- var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ),
+ var body = document.body,
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
iframe.frameBorder = iframe.width = iframe.height = 0;
}
- document.body.appendChild( iframe );
+ 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
+ // 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( "<!doctype><html><body></body></html>" );
+ iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
+ iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
display = jQuery.css( elem, "display" );
- document.body.removeChild( iframe );
+ body.removeChild( iframe );
}
// Store the correct default display