diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index 39b1faf4bd8..a04e7c388c2 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -25,6 +25,7 @@
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
+#include "mshtmdid.h"
#include "wine/debug.h"
@@ -838,6 +839,16 @@ static BOOL HTMLBodyElement_is_text_edit(HTMLDOMNode *iface)
return TRUE;
}
+static BOOL HTMLBodyElement_is_settable(HTMLDOMNode *iface, DISPID dispid)
+{
+ switch(dispid) {
+ case DISPID_IHTMLELEMENT_OUTERTEXT:
+ return FALSE;
+ default:
+ return TRUE;
+ }
+}
+
static const cpc_entry_t HTMLBodyElement_cpc[] = {
{&DIID_HTMLTextContainerEvents},
{&IID_IPropertyNotifySink},
@@ -863,7 +874,8 @@ static const NodeImplVtbl HTMLBodyElementImplVtbl = {
NULL,
HTMLBodyElement_traverse,
HTMLBodyElement_unlink,
- HTMLBodyElement_is_text_edit
+ HTMLBodyElement_is_text_edit,
+ HTMLBodyElement_is_settable
};
static const tid_t HTMLBodyElement_iface_tids[] = {
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 6d000630067..ce1ed8aa525 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1552,8 +1552,51 @@ static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ nsIDOMText *text_node;
+ nsIDOMRange *range;
+ nsAString nsstr;
+ nsresult nsres;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ if(This->node.vtbl->is_settable && !This->node.vtbl->is_settable(&This->node, DISPID_IHTMLELEMENT_OUTERTEXT)) {
+ WARN("Called on element that does not support setting the property.\n");
+ return 0x800a0258; /* undocumented error code */
+ }
+
+ if(!This->node.doc->nsdoc) {
+ FIXME("NULL nsdoc\n");
+ return E_FAIL;
+ }
+
+ nsAString_InitDepend(&nsstr, v);
+ nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &nsstr, &text_node);
+ nsAString_Finish(&nsstr);
+ if(NS_FAILED(nsres)) {
+ ERR("CreateTextNode failed\n");
+ return E_FAIL;
+ }
+
+ nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
+ if(NS_SUCCEEDED(nsres)) {
+ nsres = nsIDOMRange_SelectNode(range, This->node.nsnode);
+ if(NS_SUCCEEDED(nsres))
+ nsres = nsIDOMRange_DeleteContents(range);
+ if(NS_SUCCEEDED(nsres))
+ nsres = nsIDOMRange_InsertNode(range, (nsIDOMNode*)text_node);
+ if(NS_SUCCEEDED(nsres))
+ nsres = nsIDOMRange_SelectNodeContents(range, This->node.nsnode);
+ if(NS_SUCCEEDED(nsres))
+ nsres = nsIDOMRange_DeleteContents(range);
+ nsIDOMRange_Release(range);
+ }
+ nsIDOMText_Release(text_node);
+ if(NS_FAILED(nsres)) {
+ ERR("failed to set text: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 37c33d5cc25..fe69487dd55 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -677,6 +677,7 @@ typedef struct {
void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
void (*unlink)(HTMLDOMNode*);
BOOL (*is_text_edit)(HTMLDOMNode*);
+ BOOL (*is_settable)(HTMLDOMNode*,DISPID);
} NodeImplVtbl;
struct HTMLDOMNode {