diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index 1dc50ab216..d297d5b75a 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -782,8 +782,26 @@ static HRESULT WINAPI HTMLDOMNode_get_lastChild(IHTMLDOMNode *iface, IHTMLDOMNod
static HRESULT WINAPI HTMLDOMNode_get_previousSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p)
{
HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ nsIDOMNode *nschild = NULL;
+ HTMLDOMNode *node;
+ HRESULT hres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ nsIDOMNode_GetPreviousSibling(This->nsnode, &nschild);
+ if(!nschild) {
+ *p = NULL;
+ return S_OK;
+ }
+
+ hres = get_node(This->doc, nschild, TRUE, &node);
+ nsIDOMNode_Release(nschild);
+ if(FAILED(hres))
+ return hres;
+
+ *p = &node->IHTMLDOMNode_iface;
+ IHTMLDOMNode_AddRef(*p);
+ return S_OK;
}
static HRESULT WINAPI HTMLDOMNode_get_nextSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 64e0cf206e..8029381474 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1989,6 +1989,20 @@ static IHTMLDOMNode *_node_get_next(unsigned line, IUnknown *unk)
return next;
}
+#define node_get_prev(u) _node_get_prev(__LINE__,u)
+static IHTMLDOMNode *_node_get_prev(unsigned line, IUnknown *unk)
+{
+ IHTMLDOMNode *node = _get_node_iface(line, unk);
+ IHTMLDOMNode *prev;
+ HRESULT hres;
+
+ hres = IHTMLDOMNode_get_previousSibling(node, &prev);
+ IHTMLDOMNode_Release(node);
+ ok_(__FILE__,line) (hres == S_OK, "get_previousSibling failed: %08x\n", hres);
+
+ return prev;
+}
+
#define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
static IHTMLElement *_test_elem_get_parent(unsigned line, IUnknown *unk)
{
@@ -6681,9 +6695,16 @@ static void test_elems(IHTMLDocument2 *doc)
node = get_child_item(child_col, 0);
ok(node != NULL, "node == NULL\n");
if(node) {
+ IHTMLDOMNode *prev;
+
type = get_node_type((IUnknown*)node);
ok(type == 3, "type=%d\n", type);
node2 = node_get_next((IUnknown*)node);
+
+ prev = node_get_prev((IUnknown*)node2);
+ ok(iface_cmp((IUnknown*)node, (IUnknown*)prev), "node != prev\n");
+ IHTMLDOMNode_Release(prev);
+
IHTMLDOMNode_Release(node);
}