diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 0864e49a7c..45338fef0c 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -569,9 +569,11 @@ static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **
if(!p)
return E_POINTER;
+ if(This->node.vtbl->get_document)
+ return This->node.vtbl->get_document(&This->node, p);
+
*p = (IDispatch*)HTMLDOC(&This->node.doc->basedoc);
IDispatch_AddRef(*p);
-
return S_OK;
}
diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index b474a34cbf..2526593166 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -443,11 +443,30 @@ static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
HTMLFrameBase_destructor(&This->framebase);
}
+static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
+{
+ HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
+
+ if(!This->framebase.content_window || !This->framebase.content_window->doc) {
+ *p = NULL;
+ return S_OK;
+ }
+
+ *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
+ IDispatch_AddRef(*p);
+ return S_OK;
+}
+
#undef HTMLFRAME_NODE_THIS
static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLFrameElement_QI,
- HTMLFrameElement_destructor
+ HTMLFrameElement_destructor,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ HTMLFrameElement_get_document
};
HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLWindow *content_window)
diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c
index 218638bb8b..8c3c520609 100644
--- a/dlls/mshtml/htmliframe.c
+++ b/dlls/mshtml/htmliframe.c
@@ -58,11 +58,30 @@ static void HTMLIFrame_destructor(HTMLDOMNode *iface)
HTMLFrameBase_destructor(&This->framebase);
}
+static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p)
+{
+ HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
+
+ if(!This->framebase.content_window || !This->framebase.content_window->doc) {
+ *p = NULL;
+ return S_OK;
+ }
+
+ *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
+ IDispatch_AddRef(*p);
+ return S_OK;
+}
+
#undef HTMLIFRAME_NODE_THIS
static const NodeImplVtbl HTMLIFrameImplVtbl = {
HTMLIFrame_QI,
- HTMLIFrame_destructor
+ HTMLIFrame_destructor,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ HTMLIFrame_get_document
};
static const tid_t HTMLIFrame_iface_tids[] = {
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d1fe9f83eb..ef4642b4ba 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -445,6 +445,7 @@ typedef struct {
HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
+ HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
} NodeImplVtbl;
struct HTMLDOMNode {