Open Bug 316000 Opened 19 years ago Updated 2 years ago

iframe within a DIV displays blank after hide & display

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

All
Windows XP
defect

Tracking

()

People

(Reporter: zealli, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8) Gecko/20051025 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8) Gecko/20051025 Firefox/1.5

the iframe content will not be displayed correctly instead of a blank page if I placed it in a DIV and hide the DIV first.

Reproducible: Always

Steps to Reproduce:
created such a html page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  lang="en">
<body>
<div id="testdiv"></div>
<p><input type=button onclick="document.getElementById('testdiv').style.display='none';" value="hide">&nbsp;<input type=button onclick="document.getElementById('testdiv').style.display='';" value="show"></p>
<script>
document.getElementById('testdiv').innerHTML = 'Other information<br /><iframe frameborder=1 onload="javascript:{alert(\'call after iframe loaded.\');document.getElementById(\'testdiv\').style.display=\'\';}" src="http://www.google.com/" height=300 width=800></iframe>';
document.getElementById('testdiv').style.display='none';
</script>
</body>
</html>

Actual Results:  
just create such a simple html page, and view it in firefox.
then u'll get a blank iframe content.
then after u click the 'hide' button and 'show' it, it'll displays OK!


but if I move the line
document.getElementById('testdiv').style.display='none';
above the line
document.getElementById('testdiv').innerHTML = ...

it seems everything is OK
Keywords: testcase
Attached file Testcase
Iframe is added  to the "testDiv" with innerHTML. Testdiv:s display attribute is set to "none" right away, but changed to "block" once the iframe is loaded (onload on the iframe)
Component: General → Layout: HTML Frames
Product: Firefox → Core
QA Contact: general → layout.html-frames
Version: unspecified → 1.0 Branch
If you open the testcase locally, you will see a blinking cursor on the left part of the tab, where the favicon is
bug also seen on trunk
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.9a1) Gecko/20051111 SeaMonkey/1.5a Mnenhy/0.7.2.0
Version: 1.0 Branch → 1.8 Branch
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: 1.8 Branch → Trunk
This loooks a bit like bug 308182
An additional problem I found is, after an Iframe has been scrolled and then is hided and displayed again, the scroll position is lost. This is particularly annoying in today's webapps, where iframes are becoming very popular to make fancy websites.

The original testcase can also reproduce this behavior, just load the iframe, scroll it down, hide it, and then show it again. The scroll position is lost.
this might be a dupe of bug 191176


(In reply to comment #5)
> An additional problem I found is, after an Iframe has been scrolled and then is
> hided and displayed again, the scroll position is lost. 

bug 159229, bug 94623, plus others
Product: Core → Core Graveyard
Component: Layout: HTML Frames → Layout: Images
Product: Core Graveyard → Core
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: