Side navigation
Ticket #6901: after-before-bug.html
File after-before-bug.html, 0.9 KB (added by Niko Viitala, August 12, 2010 08:58AM UTC)
after/before bug example
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<div id="div1">
<span id="frame1"></span>
</div>
<div id="div2">
<span id="frame2"></span>
</div>
<a href="javascript:change()">change</a>
<script type="text/javascript">
var $frame = $('<iframe style="width:200px; height:100px;">');
$('#frame1').html( $frame );
setTimeout( function() {
var doc = $frame[0].contentWindow.document;
var $body = $('body',doc);
$body.html('test1');
}, 100);
var $frame2 = $('<iframe style="width:200px; height:100px;">');
$('#frame2').html( $frame2 );
setTimeout( function() {
var doc2 = $frame2[0].contentWindow.document;
var $body2 = $('body',doc2);
$body2.html('test2');
}, 100);
function change() {
$("#div2").after($("#div1"));
}
</script>
</body>
</html>
Download in other formats:
Original Format
File after-before-bug.html, 0.9 KB (added by Niko Viitala, August 12, 2010 08:58AM UTC)
after/before bug example
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<div id="div1">
<span id="frame1"></span>
</div>
<div id="div2">
<span id="frame2"></span>
</div>
<a href="javascript:change()">change</a>
<script type="text/javascript">
var $frame = $('<iframe style="width:200px; height:100px;">');
$('#frame1').html( $frame );
setTimeout( function() {
var doc = $frame[0].contentWindow.document;
var $body = $('body',doc);
$body.html('test1');
}, 100);
var $frame2 = $('<iframe style="width:200px; height:100px;">');
$('#frame2').html( $frame2 );
setTimeout( function() {
var doc2 = $frame2[0].contentWindow.document;
var $body2 = $('body',doc2);
$body2.html('test2');
}, 100);
function change() {
$("#div2").after($("#div1"));
}
</script>
</body>
</html>