Closed Bug 12294 Opened 25 years ago Closed 25 years ago

Can't get iframe's document property

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: slogan, Assigned: vidur)

Details

var listFrame = top.document.getElementById("MyList");
	dump( "listFrame " + listFrame + "\n" );
	DumpDOM( listFrame );
	var listDocument = listFrame.document;

MyList is an iframe.
The first dump generates:

listFrame [object HTMLIFrameElement]

DumpDOM shows:

--------------------- DumpDOM ---------------------
<IFRAME name="AddBuddyGroupList" class="AddBuddyGroupList" src="about:blank" id=
"AddBuddyGroupList">
----------- IFRAME -----------
  <HTML>
    <HEAD>
    <BODY>
--------- End IFRAME ---------
------------------- End DumpDOM -------------------

If I do a dump of the listDocument variable, I get:

listDocument = undefined

But, according to my documentation for iframes, document should be a property of
an iframe.

I need this document to be able to dynamically add content to the iframe
document.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
You should be able to get your document off the window associated with the
iframe - top.frames["MyList"].document should work. Not sure what you're
documentation says, but neither the W3C spec, nor our 4.x JS documentation, nor
IE's documentation has document as a property of the IFRAME element.

Marking the bug INVALID, but cc:ing Tom Pixley to see if he thinks we should
implement it nonetheless.
The documentation was Dynamic HTML, danny Goodman, O;Reilly publishers. The
iframe documentation (as I read it) says that document is DOM level 1 property
of iframe, supported also by IE4, but not supported by NS (as of the writing of
the book, e.g., 4.x and earlier). I figured because it was listed there as being
supported in DOM level 1, that we would support it in 5.0.

I'll try the workaround. Thanks.
I see no document property for HTMLIFrameElement in W3C spec either. However,
HTMLIFrameElement inherits the ownerDocument property from Node. Try:

var listDocument = listFrame.ownerDocument;
dump( "listDocument " + listDocument + "\n" );

I hope it helps.
Status: RESOLVED → VERIFIED
Verified on W3C specs.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.