Closed Bug 235757 Opened 21 years ago Closed 15 years ago

IFRAME children is missing from DOM

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: rail, Unassigned)

References

Details

Attachments

(1 file)

User-Agent: Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:) Gecko/20040226 I have a document with two divs and two iframes. Clicking on the divs is supposed to show one of the iframes and hide the other. However, this fails in mozilla because it cannot find the second iframe. Works fine in iE and Netscape 6.2 Reproducible: Always Steps to Reproduce: The following is the code that shows the problem <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <style> #tocframe { display: none; height: 100%; width: 100%; z-order: -1; } #framesearch { display: none; height: 100%; width: 100%; } </style> <script> function showToc() { document.getElementById("framesearch").style.display = "none"; document.getElementById("tocframe").style.display = "block"; } function showSearch() { alert("showing search " + document.getElementById ("framesearch")); document.getElementById("framesearch").style.display = "block"; alert("showing search"); document.getElementById("tocframe").style.display = "none"; } </script> </HEAD> <BODY> <div onClick="showToc()"> show toc </div> <div onClick="showSearch()"> show search </div> <iframe id="framesearch" src="blanknav.html" /> <iframe id="tocframe" src="testswap.html" /> </BODY> </HTML> Actual Results: The alert will show that the value returned is null Expected Results: I want the iframe returned.
It contains just html. You can change the extension and use it.
To parser. The unclosed outer iframe means we never parse the inner one for some reason.... it's not in the DOM. That said, closing your tags would be a good idea if you want them to work; if we fix this bug the inner iframe will be a chld of the outer one, and the script will still not work the way you want it to.
Assignee: general → parser
Component: DOM → HTML: Parser
(In reply to comment #2) > To parser. The unclosed outer iframe means we never parse the inner one for > some reason.... it's not in the DOM. > That said, closing your tags would be a good idea if you want them to work; if > we fix this bug the inner iframe will be a chld of the outer one, and the script > will still not work the way you want it to. The iframe is closed man. The line is <iframe id="framesearch" src="blanknav.html" /> it has a /> which means close. Do you mean, I need to specify </iframe> explicitly. Roshan
In HTML, <foo/> is the same as <foo> with some random junk. You are probably confusing this with XML, in which the syntax is different.
Ok that worked for me. Thanks, Roshan
bz: didn't we go through this on a recent bug? IFRAME, for some bizarre reason, has a content model that includes IFRAME, so nesting in this case is the right thing to do...INVALID?
Just a note. I was looking up the HTML 4 spec. It clearly states that nested content for an iframe should only be displayed by a user agent that doesn't support iframes. Judging by that, I think the current behaviour is correct where it doesn't put it into the DOM. However, this is not the behaviour for other HTML elements. This can cause confusion. I guess the best option would be to maybe document this quirk somewhere. In most cases, IE is used as a reference although it has the worst standards support I have seen. In my case even Netscape 6.2 worked that's why I was bewildered when it didn't work in Firefox, which I use as my default browser both at home and work. As far as this bug goes, you can close it.
Confirming what I believe is a valid bug. The IFRAME children should be in the DOM just as the alternate content for OBJECT for example.
Severity: major → minor
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Summary: getElementById doesn't find the second iframe → IFRAME children is missing from DOM
Might be related to bug 147070.
Depends on: 242298
Assignee: parser → nobody
QA Contact: ian → parser
INVALID per HTML5: /> doesn't close an iframe, and iframe's content is parsed like the content of <textarea>.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: