create a page with two iframes
(I will try to attach the files as well)
container.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Iframe test</title>
<script type="text/javascript" src="jquery-latest.js"></script>
</head>
<body>
<iframe src="left.html"></iframe>
<iframe src="right.html"></iframe>
</body>
</html>
left.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Iframe test</title>
<body style="background-color:yellow">
<p>This is 'left'</p>
</body>
</html>
right.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Iframe test</title>
<body style="background-color:red">
<p>This is 'right'</p>
</body>
</html>
Load container in ie 6 or 7
(it is easier to reproduce in ie 6 because of the way the refresh button is displayed)
Note that there is one yellow and one red iframe.
Click on refresh or hit F5
note that after refesh, the left Iframe is now showing the incorrect content.
I have tracked the problem down to this section (about line 1488 in the current build):
else if ( jQuery.browser.msie ) {
// Only works if you document.write() it
document.write("<scr" + "ipt id=ie_init defer=true " +
"src=//:></script>");
// Use the defer script hack
var script = document.getElementById("ie_init");
// script does not exist if jQuery is loaded dynamically
if ( script )
script.onreadystatechange = function() {
if ( this.readyState != "complete" ) return;
this.parentNode.removeChild( this );
jQuery.ready();
};
// Clear from memory
script = null;
// If Safari is used
}
The specific line that is causing the problem is:
this.parentNode.removeChild( this );
By commenting out this line, the problem goes away.
Not sure why this is happening. Seems clear that this is a bug in IE, but we shouldn't trip over it if we can help it.
Also not sure if this would rear it's ugly head in any other way or if it is limited to just refreshing iframes.
Would it be so bad to leave the defered script in the dom? Is there another way to remove it?