Closed
Bug 647059
Opened 14 years ago
Closed 14 years ago
iframe has no .document if I previously removed an iframe with the same name
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
DUPLICATE
of bug 170799
People
(Reporter: bjarnimaster, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.16) Gecko/20110319 AskTbARS/3.9.1.14019 Firefox/3.6.16 ( .NET CLR 3.5.30729; .NET4.0E)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.16) Gecko/20110319 AskTbARS/3.9.1.14019 Firefox/3.6.16 ( .NET CLR 3.5.30729; .NET4.0E)
I create an iframe with a name (let's call it "aniframe"), and then I remove it. Later, I create a new iframe of the same name. The new iframe has a null .document attribute. Consider the following HTML that exhibits this:
<html>
<script type="text/javascript">
function loader() {
alert(frames['aniframe'].document);
document.getElementById("content").innerHTML = "Hello world";
alert(frames['aniframe'].document);
document.getElementById("content").innerHTML = '<iframe src="" id="aniframe" name="aniframe">';
alert(frames['aniframe'].document);
}
window.onload = loader;
</script>
<body>
<div id="content">
<iframe src="" id="aniframe" name="aniframe">
</div>
</body>
</html>
An easy workaround would be to make the name of the new iframe different (this works fine and has a non-null document attribute).
Reproducible: Always
Steps to Reproduce:
1. Create an iframe
2. Remove it from the document (in the example I changed the .innerHTML of the parent div)
3. Add an iframe with the same name to the document, and look at its .document attribute
Actual Results:
The new iframe has a null .document attribute
Expected Results:
The new iframe should have a non-null .document attribute, of type HTMLDocument.
Updated•14 years ago
|
Severity: minor → normal
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows Vista → All
Hardware: x86 → All
Version: unspecified → Trunk
Comment 1•14 years ago
|
||
Your issue here is actually that frames['aniframe'] is still returning the old frame. You can check this by comparing it to what document.getElementById("aniframe") is returning before and after the innerHTML set.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•