diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c
index 8471b710f9..32b39cb10f 100644
--- a/dlls/mshtml/htmlanchor.c
+++ b/dlls/mshtml/htmlanchor.c
@@ -466,8 +466,14 @@ static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR
static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
{
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ nsAString hash_str;
+ nsresult nsres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ nsAString_Init(&hash_str, NULL);
+ nsres = nsIDOMHTMLAnchorElement_GetHash(This->nsanchor, &hash_str);
+ return return_nsstr(nsres, &hash_str, p);
}
static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 749d3c020a..3141643969 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1468,6 +1468,22 @@ static void _test_anchor_hostname(unsigned line, IUnknown *unk, const char *host
SysFreeString(str);
}
+#define test_anchor_hash(a,h) _test_anchor_hash(__LINE__,a,h)
+static void _test_anchor_hash(unsigned line, IHTMLElement *elem, const char *exhash)
+{
+ IHTMLAnchorElement *anchor = _get_anchor_iface(line, (IUnknown*)elem);
+ BSTR str;
+ HRESULT hres;
+
+ hres = IHTMLAnchorElement_get_hash(anchor, &str);
+ ok_(__FILE__,line)(hres == S_OK, "get_hash failed: %08x\n", hres);
+ if(exhash)
+ ok_(__FILE__,line)(!strcmp_wa(str, exhash), "hash = %s, expected %s\n", wine_dbgstr_w(str), exhash);
+ else
+ ok_(__FILE__,line)(!str, "hash = %s, expected NULL\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+}
+
#define test_option_text(o,t) _test_option_text(__LINE__,o,t)
static void _test_option_text(unsigned line, IHTMLOptionElement *option, const char *text)
{
@@ -6380,6 +6396,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_anchor_put_href((IUnknown*)elem, "http://test/");
test_anchor_href((IUnknown*)elem, "http://test/");
test_anchor_hostname((IUnknown*)elem, "test");
+ test_anchor_hash(elem, NULL);
/* target */
test_anchor_get_target((IUnknown*)elem, NULL);
@@ -6401,6 +6418,9 @@ static void test_elems(IHTMLDocument2 *doc)
test_anchor_put_name((IUnknown*)elem, NULL);
test_anchor_put_name((IUnknown*)elem, "x");
+ test_anchor_put_href((IUnknown*)elem, "http://test/#hash");
+ test_anchor_hash(elem, "#hash");
+
IHTMLElement_Release(elem);
}