aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2011-05-20 11:22:52 -0400
committertimmywil <tim.willison@thisismedium.com>2011-05-20 11:22:52 -0400
commitb43910a496ccb2b44dcc11b64667e21521aa4994 (patch)
treeb37eb2bbd68749c393aa44f324bc4d91cf398bf4 /src
parentf82b9dddc498efdfbcd0978f8ba3e1da3b48eff3 (diff)
downloadjquery-b43910a496ccb2b44dcc11b64667e21521aa4994.tar.gz
jquery-b43910a496ccb2b44dcc11b64667e21521aa4994.zip
Landing pull request 352. Slightly improved defaultDisplay() and Throbber of Doom. Fixes #8994.
More Details: - https://github.com/jquery/jquery/pull/352 - http://bugs.jquery.com/ticket/8994
Diffstat (limited to 'src')
-rw-r--r--src/effects.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/effects.js b/src/effects.js
index e179c3e3c..224962773 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -574,7 +574,8 @@ function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
- var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ),
+ var body = document.body,
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
@@ -588,14 +589,15 @@ function defaultDisplay( nodeName ) {
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 );
@@ -604,7 +606,7 @@ function defaultDisplay( nodeName ) {
display = jQuery.css( elem, "display" );
- document.body.removeChild( iframe );
+ body.removeChild( iframe );
}
// Store the correct default display