Closed Bug 47947 Opened 24 years ago Closed 24 years ago

contentDocument property doesnt get populated remains undefined

Categories

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

x86
Other
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: bora123, Assigned: pollmann)

Details

The contentDocument property of frames and iframes is not populated. Here is a 
test case. The contentDocument property remains undefined. You can put another 
file as src document from your local disk, or but it as "about:blank".

<html>
<head>
<script>
function dcontentDocument() {
    alert(window.frames['M1'].contentDocument);  
}  
</script>
<body bgcolor="#c0c0c0">
<IFRAME width=400 height=400 NAME="M1" src="test1.htm"></IFRAME>
<button onclick="dcontentDocument()">Show</button>
</body>
</html>
This attribute is new to DOM level 2:
http://www.w3.org/TR/DOM-Level-2/idl-definitions.html

The only description I found was here:
http://msdn.microsoft.com/workshop/browser/hosting/printpreview/reference/properties/contentDocument.asp

Johnny, do you know what the plans are for this one?
Component: HTMLFrames → DOM Level 2
The contentDocument property that the DOM defines is a property on the 'FRAME'
or 'IFRAME' elements, it's not a property on the window object assocciated with
the frame or iframe.

So you either do:

function dcontentDocument() {
    alert(window.frames['M1'].document);
}

or you do:

function dcontentDocument() {
    alert(document.getElementsByName('M1')[0].contentDocument);
}

The window is not the same object as the element in the DOM that caused the
window to show up, and they're not of the same type.

Marking INVALID. (hope you don't mind Eric).
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Component: DOM Level 2 → DOM HTML
VERIFIED invalid
Status: RESOLVED → VERIFIED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: chrispetersen → general
You need to log in before you can comment on or make changes to this bug.