contentDocument property doesnt get populated remains undefined

VERIFIED INVALID

Status

()

P3
major
VERIFIED INVALID
19 years ago
11 years ago

People

(Reporter: bora123, Assigned: pollmann)

Tracking

Trunk
x86
Other
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

19 years ago
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>
(Assignee)

Comment 1

19 years ago
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
Last Resolved: 19 years ago
Resolution: --- → INVALID
Component: DOM Level 2 → DOM HTML

Comment 3

18 years ago
VERIFIED invalid
Status: RESOLVED → VERIFIED

Updated

11 years ago
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.