There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -556,35 +556,37 @@ function defaultDisplay( nodeName ) { | ||
var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ), | ||
display = elem.css( "display" ); | ||
|
||
elem.remove(); | ||
elem.remove(); | ||
|
||
if ( display === "none" || display === "" ) { | ||
|
||
// Get element's real default display by attaching it to a temp iframe | ||
// Conritbutions from Louis Remi and Julian Aurbourg | ||
// based on recommendation by Louis Remi | ||
|
||
// No iframe to use yet, so create it | ||
if ( !iframe ) { | ||
|
||
iframe = document.createElement( "iframe" ); | ||
iframe.width = iframe.height = 0; | ||
iframe.frameBorder = iframe.width = iframe.height = 0; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rwaldron
Author
Member
|
||
} | ||
|
||
document.body.appendChild( iframe ); | ||
document.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; | ||
This comment has been minimized.
Sorry, something went wrong.
jdalton
Member
|
||
iframeDoc.write("<!doctype><html><body></body></html>"); | ||
|
||
} else { | ||
|
||
// Reuse previous iframe | ||
document.body.appendChild( iframe ); | ||
|
||
iframeDoc.write( "<!doctype><html><body></body></html>" ); | ||
This comment has been minimized.
Sorry, something went wrong.
jdalton
Member
|
||
} | ||
|
||
elem = iframeDoc.createElement( nodeName ); | ||
|
||
iframeDoc.body.appendChild( elem ); | ||
|
||
display = jQuery( elem ).css( "display" ); | ||
display = jQuery.css( elem, "display" ); | ||
|
||
iframe.parentNode.removeChild( iframe ); | ||
document.body.removeChild( iframe ); | ||
This comment has been minimized.
Sorry, something went wrong.
jdalton
Member
|
||
} | ||
|
||
// Store the correct default display | ||
2 comments
on commit a76decc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't take this the wrong way, but this is all so unbelievably silly and wasteful. And enough with the "show me where it fails" nonsense. Yes, you should close the document stream after writing. You don't need to see a video of a failure to take that course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the last thing you ever want to do during load is to insert a @#$! IFRAME. It's the most expensive operation in browser scripting (a whole new window).
This is why these projects are such failures. You've got inexperienced developers trying desperately to solve every "problem" (real or perceived) for every situation and "all browsers", based almost exclusively on trial and error. There aren't any ideas here, just empirical observations and guesswork.
Give it up as the world has figured out that these monoliths are just a waste of time.
I know Opera may still flash an iframe on the screen for a split-second. It's why I do
iframe.style.display = 'none';