Skip to content
Browse files
Pass iframe support tests at doc ready. Fixes support fail in FF7
  • Loading branch information
timmywil committed Oct 31, 2011
1 parent 0752687 commit 006fde228da59ae71c11a67ef65dbfc09e788773
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
@@ -32,7 +32,9 @@
<script src="../../../src/dimensions.js"></script>
window.parent.supportCallback( jQuery( "body" ).css( "backgroundColor" ), );
jQuery(function() {
window.parent.supportCallback( jQuery( "body" ).css( "backgroundColor" ), );
@@ -33,12 +33,14 @@ supportIFrameTest( "proper boxModel in compatMode CSS1Compat (IE6 and IE7)", "bo

supportIFrameTest( "body background is not lost if set prior to loading jQuery (#9238)", "bodyBackground", function( color, support ) {
expect( 2 );
var okValue = {
var i,
passed = true,
okValue = {
"#000000": true,
"rgb(0, 0, 0)": true
ok( okValue[ color ], "color was not reset (" + color + ")" );
var i, passed = true;

for ( i in ) {
if ([ i ] !== support[ i ] ) {
passed = false;

1 comment on commit 006fde2

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I actually sorta figured out why FF7 complains and Chrome doesn't, and Opera does sometimes before this change.

It seems as if Firefox lets 2 windows run javascript independent of each other (as expected?). By the time the window.supportCallback actually runs in FF7, there is no gaurantee the support tests ran in the IFRAME yet. If you change the setTimeout in supportIFrameTest to something like 100 instead of 0, FF complains a lot less often. It's a race.

It seems as if it's the same situation in Opera, however Opera seems like the document.ready on the iframe fires early enough to never complain. It's still a race, but the IFRAME always wins. If you want the IFRAME to lose, just put an alert('hi!'); after window.parent.supportCallback( jQuery( "body" ).css( "backgroundColor" ), ); and you'll see that the IFRAME now loses because the alert stops execution on that IFRAME.

For Chrome, different story. It seems as if Chrome finishes executing all the code in the IFRAME (including doc ready ?) before executing the callback on the parent window. To demonstrate, go ahead and and put that same alert in. If you notice, if you close the alert after 4 seconds, it's four more seconds before the test finishing running. It's as if the alert stops JS execution on both windows!


Please sign in to comment.